home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / DTS Sample Code / Macintosh Sample Code / Monthly Releases (Compressed) / MacDTS.Sample.Code.88.11.sit / 002. TESample / TESample.c < prev    next >
MacBinary  |  1988-11-01  |  51.8 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Tue Nov 1 15:48:27 1988, modified Tue Nov 1 15:48:27 1988, creator 'MPS ', type ASCII, 52327 bytes "TESample.c" , at 0xcce7 502 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0a 54 45 53 61 6d 70 | 6c 65 2e 63 00 00 00 00 |..TESamp|le.c....|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 cc 67 00 | 00 01 f6 9f 93 d3 9b 9f |......g.|........|
|00000060| 93 d3 9b 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 63 97 00 00 |........|....c...|
|00000080| 2f 2a 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |/*------|--------|
|00000090| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000d0| 0d 23 0d 23 09 41 70 70 | 6c 65 20 4d 61 63 69 6e |.#.#.App|le Macin|
|000000e0| 74 6f 73 68 20 44 65 76 | 65 6c 6f 70 65 72 20 54 |tosh Dev|eloper T|
|000000f0| 65 63 68 6e 69 63 61 6c | 20 53 75 70 70 6f 72 74 |echnical| Support|
|00000100| 0d 23 0d 23 09 4d 75 6c | 74 69 46 69 6e 64 65 72 |.#.#.Mul|tiFinder|
|00000110| 2d 41 77 61 72 65 20 53 | 69 6d 70 6c 65 20 54 65 |-Aware S|imple Te|
|00000120| 78 74 45 64 69 74 20 53 | 61 6d 70 6c 65 20 41 70 |xtEdit S|ample Ap|
|00000130| 70 6c 69 63 61 74 69 6f | 6e 0d 23 0d 23 09 54 45 |plicatio|n.#.#.TE|
|00000140| 53 61 6d 70 6c 65 0d 23 | 0d 23 09 54 68 69 73 20 |Sample.#|.#.This |
|00000150| 66 69 6c 65 3a 20 54 45 | 53 61 6d 70 6c 65 2e 63 |file: TE|Sample.c|
|00000160| 09 2d 09 43 20 53 6f 75 | 72 63 65 0d 23 0d 23 09 |.-.C Sou|rce.#.#.|
|00000170| 43 6f 70 79 72 69 67 68 | 74 20 a9 20 31 39 38 38 |Copyrigh|t . 1988|
|00000180| 20 41 70 70 6c 65 20 43 | 6f 6d 70 75 74 65 72 2c | Apple C|omputer,|
|00000190| 20 49 6e 63 2e 0d 23 09 | 41 6c 6c 20 72 69 67 68 | Inc..#.|All righ|
|000001a0| 74 73 20 72 65 73 65 72 | 76 65 64 2e 0d 23 0d 23 |ts reser|ved..#.#|
|000001b0| 09 56 65 72 73 69 6f 6e | 73 3a 09 31 2e 30 09 09 |.Version|s:.1.0..|
|000001c0| 09 09 09 30 38 2f 38 38 | 0d 23 09 09 09 09 31 2e |...08/88|.#....1.|
|000001d0| 30 31 09 09 09 09 31 31 | 2f 38 38 0d 23 0d 23 09 |01....11|/88.#.#.|
|000001e0| 43 6f 6d 70 6f 6e 65 6e | 74 73 3a 09 54 45 53 61 |Componen|ts:.TESa|
|000001f0| 6d 70 6c 65 2e 70 09 09 | 09 4e 6f 76 65 6d 62 65 |mple.p..|.Novembe|
|00000200| 72 20 31 2c 20 31 39 38 | 38 0d 23 09 09 09 09 54 |r 1, 198|8.#....T|
|00000210| 45 53 61 6d 70 6c 65 2e | 63 09 09 09 4e 6f 76 65 |ESample.|c...Nove|
|00000220| 6d 62 65 72 20 31 2c 20 | 31 39 38 38 0d 23 09 09 |mber 1, |1988.#..|
|00000230| 09 09 54 45 53 61 6d 70 | 6c 65 2e 61 09 09 09 4e |..TESamp|le.a...N|
|00000240| 6f 76 65 6d 62 65 72 20 | 31 2c 20 31 39 38 38 0d |ovember |1, 1988.|
|00000250| 23 09 09 09 09 54 45 53 | 61 6d 70 6c 65 2e 72 09 |#....TES|ample.r.|
|00000260| 09 09 4e 6f 76 65 6d 62 | 65 72 20 31 2c 20 31 39 |..Novemb|er 1, 19|
|00000270| 38 38 0d 23 09 09 09 09 | 54 45 53 61 6d 70 6c 65 |88.#....|TESample|
|00000280| 2e 68 09 09 09 4e 6f 76 | 65 6d 62 65 72 20 31 2c |.h...Nov|ember 1,|
|00000290| 20 31 39 38 38 0d 23 09 | 09 09 09 50 54 45 53 61 | 1988.#.|...PTESa|
|000002a0| 6d 70 6c 65 2e 6d 61 6b | 65 09 09 4e 6f 76 65 6d |mple.mak|e..Novem|
|000002b0| 62 65 72 20 31 2c 20 31 | 39 38 38 0d 23 09 09 09 |ber 1, 1|988.#...|
|000002c0| 09 43 54 45 53 61 6d 70 | 6c 65 2e 6d 61 6b 65 09 |.CTESamp|le.make.|
|000002d0| 09 4e 6f 76 65 6d 62 65 | 72 20 31 2c 20 31 39 38 |.Novembe|r 1, 198|
|000002e0| 38 0d 23 0d 23 09 54 45 | 53 61 6d 70 6c 65 20 69 |8.#.#.TE|Sample i|
|000002f0| 73 20 61 6e 20 65 78 61 | 6d 70 6c 65 20 61 70 70 |s an exa|mple app|
|00000300| 6c 69 63 61 74 69 6f 6e | 20 74 68 61 74 20 64 65 |lication| that de|
|00000310| 6d 6f 6e 73 74 72 61 74 | 65 73 20 68 6f 77 20 0d |monstrat|es how .|
|00000320| 23 09 74 6f 20 69 6e 69 | 74 69 61 6c 69 7a 65 20 |#.to ini|tialize |
|00000330| 74 68 65 20 63 6f 6d 6d | 6f 6e 6c 79 20 75 73 65 |the comm|only use|
|00000340| 64 20 74 6f 6f 6c 62 6f | 78 20 6d 61 6e 61 67 65 |d toolbo|x manage|
|00000350| 72 73 2c 20 6f 70 65 72 | 61 74 65 20 0d 23 09 73 |rs, oper|ate .#.s|
|00000360| 75 63 63 65 73 73 66 75 | 6c 6c 79 20 75 6e 64 65 |uccessfu|lly unde|
|00000370| 72 20 4d 75 6c 74 69 46 | 69 6e 64 65 72 2c 20 68 |r MultiF|inder, h|
|00000380| 61 6e 64 6c 65 20 64 65 | 73 6b 20 61 63 63 65 73 |andle de|sk acces|
|00000390| 73 6f 72 69 65 73 20 61 | 6e 64 20 0d 23 09 63 72 |sories a|nd .#.cr|
|000003a0| 65 61 74 65 2c 20 67 72 | 6f 77 2c 20 61 6e 64 20 |eate, gr|ow, and |
|000003b0| 7a 6f 6f 6d 20 77 69 6e | 64 6f 77 73 2e 20 54 68 |zoom win|dows. Th|
|000003c0| 65 20 66 75 6e 64 61 6d | 65 6e 74 61 6c 20 54 65 |e fundam|ental Te|
|000003d0| 78 74 45 64 69 74 20 0d | 23 09 74 6f 6f 6c 62 6f |xtEdit .|#.toolbo|
|000003e0| 78 20 63 61 6c 6c 73 20 | 61 6e 64 20 54 65 78 74 |x calls |and Text|
|000003f0| 45 64 69 74 20 61 75 74 | 6f 73 63 72 6f 6c 6c 20 |Edit aut|oscroll |
|00000400| 61 72 65 20 64 65 6d 6f | 6e 73 74 72 61 74 65 64 |are demo|nstrated|
|00000410| 2e 20 49 74 20 0d 23 09 | 61 6c 73 6f 20 73 68 6f |. It .#.|also sho|
|00000420| 77 73 20 68 6f 77 20 74 | 6f 20 63 72 65 61 74 65 |ws how t|o create|
|00000430| 20 61 6e 64 20 6d 61 69 | 6e 74 61 69 6e 20 73 63 | and mai|ntain sc|
|00000440| 72 6f 6c 6c 62 61 72 20 | 63 6f 6e 74 72 6f 6c 73 |rollbar |controls|
|00000450| 2e 0d 23 0d 23 09 49 74 | 20 64 6f 65 73 20 6e 6f |..#.#.It| does no|
|00000460| 74 20 62 79 20 61 6e 79 | 20 6d 65 61 6e 73 20 64 |t by any| means d|
|00000470| 65 6d 6f 6e 73 74 72 61 | 74 65 20 61 6c 6c 20 74 |emonstra|te all t|
|00000480| 68 65 20 74 65 63 68 6e | 69 71 75 65 73 20 79 6f |he techn|iques yo|
|00000490| 75 20 0d 23 09 6e 65 65 | 64 20 66 6f 72 20 61 20 |u .#.nee|d for a |
|000004a0| 6c 61 72 67 65 20 61 70 | 70 6c 69 63 61 74 69 6f |large ap|plicatio|
|000004b0| 6e 2e 20 49 6e 20 70 61 | 72 74 69 63 75 6c 61 72 |n. In pa|rticular|
|000004c0| 2c 20 53 61 6d 70 6c 65 | 20 64 6f 65 73 20 6e 6f |, Sample| does no|
|000004d0| 74 20 0d 23 09 63 6f 76 | 65 72 20 65 78 63 65 70 |t .#.cov|er excep|
|000004e0| 74 69 6f 6e 20 68 61 6e | 64 6c 69 6e 67 2c 20 6d |tion han|dling, m|
|000004f0| 75 6c 74 69 70 6c 65 20 | 77 69 6e 64 6f 77 73 2f |ultiple |windows/|
|00000500| 64 6f 63 75 6d 65 6e 74 | 73 2c 20 0d 23 09 73 6f |document|s, .#.so|
|00000510| 70 68 69 73 74 69 63 61 | 74 65 64 20 6d 65 6d 6f |phistica|ted memo|
|00000520| 72 79 20 6d 61 6e 61 67 | 65 6d 65 6e 74 2c 20 70 |ry manag|ement, p|
|00000530| 72 69 6e 74 69 6e 67 2c | 20 6f 72 20 75 6e 64 6f |rinting,| or undo|
|00000540| 2e 20 41 6c 6c 20 6f 66 | 20 0d 23 09 74 68 65 73 |. All of| .#.thes|
|00000550| 65 20 61 72 65 20 76 69 | 74 61 6c 20 70 61 72 74 |e are vi|tal part|
|00000560| 73 20 6f 66 20 61 20 6e | 6f 72 6d 61 6c 20 66 75 |s of a n|ormal fu|
|00000570| 6c 6c 2d 73 69 7a 65 64 | 20 61 70 70 6c 69 63 61 |ll-sized| applica|
|00000580| 74 69 6f 6e 2e 0d 23 0d | 23 09 54 68 69 73 20 61 |tion..#.|#.This a|
|00000590| 70 70 6c 69 63 61 74 69 | 6f 6e 20 69 73 20 61 6e |pplicati|on is an|
|000005a0| 20 65 78 61 6d 70 6c 65 | 20 6f 66 20 74 68 65 20 | example| of the |
|000005b0| 66 6f 72 6d 20 6f 66 20 | 61 20 4d 61 63 69 6e 74 |form of |a Macint|
|000005c0| 6f 73 68 20 0d 23 09 61 | 70 70 6c 69 63 61 74 69 |osh .#.a|pplicati|
|000005d0| 6f 6e 3b 20 69 74 20 69 | 73 20 4e 4f 54 20 61 20 |on; it i|s NOT a |
|000005e0| 74 65 6d 70 6c 61 74 65 | 2e 20 49 74 20 69 73 20 |template|. It is |
|000005f0| 4e 4f 54 20 69 6e 74 65 | 6e 64 65 64 20 74 6f 20 |NOT inte|nded to |
|00000600| 62 65 20 0d 23 09 75 73 | 65 64 20 61 73 20 61 20 |be .#.us|ed as a |
|00000610| 66 6f 75 6e 64 61 74 69 | 6f 6e 20 66 6f 72 20 74 |foundati|on for t|
|00000620| 68 65 20 6e 65 78 74 20 | 77 6f 72 6c 64 2d 63 6c |he next |world-cl|
|00000630| 61 73 73 2c 20 62 65 73 | 74 2d 73 65 6c 6c 69 6e |ass, bes|t-sellin|
|00000640| 67 2c 20 0d 23 09 36 30 | 30 4b 20 61 70 70 6c 69 |g, .#.60|0K appli|
|00000650| 63 61 74 69 6f 6e 2e 20 | 41 20 73 74 69 63 6b 20 |cation. |A stick |
|00000660| 66 69 67 75 72 65 20 64 | 72 61 77 69 6e 67 20 6f |figure d|rawing o|
|00000670| 66 20 74 68 65 20 68 75 | 6d 61 6e 20 62 6f 64 79 |f the hu|man body|
|00000680| 20 6d 61 79 20 0d 23 09 | 62 65 20 61 20 67 6f 6f | may .#.|be a goo|
|00000690| 64 20 65 78 61 6d 70 6c | 65 20 6f 66 20 74 68 65 |d exampl|e of the|
|000006a0| 20 66 6f 72 6d 20 66 6f | 72 20 61 20 70 61 69 6e | form fo|r a pain|
|000006b0| 74 69 6e 67 2c 20 62 75 | 74 20 74 68 61 74 20 64 |ting, bu|t that d|
|000006c0| 6f 65 73 20 6e 6f 74 20 | 0d 23 09 6d 65 61 6e 20 |oes not |.#.mean |
|000006d0| 69 74 20 73 68 6f 75 6c | 64 20 62 65 20 75 73 65 |it shoul|d be use|
|000006e0| 64 20 61 73 20 74 68 65 | 20 62 61 73 69 73 20 66 |d as the| basis f|
|000006f0| 6f 72 20 74 68 65 20 6e | 65 78 74 20 4d 6f 6e 61 |or the n|ext Mona|
|00000700| 20 4c 69 73 61 2e 0d 23 | 0d 23 09 57 65 20 72 65 | Lisa..#|.#.We re|
|00000710| 63 6f 6d 6d 65 6e 64 20 | 74 68 61 74 20 79 6f 75 |commend |that you|
|00000720| 20 72 65 76 69 65 77 20 | 74 68 69 73 20 70 72 6f | review |this pro|
|00000730| 67 72 61 6d 20 6f 72 20 | 53 61 6d 70 6c 65 20 62 |gram or |Sample b|
|00000740| 65 66 6f 72 65 20 0d 23 | 09 62 65 67 69 6e 6e 69 |efore .#|.beginni|
|00000750| 6e 67 20 61 20 6e 65 77 | 20 61 70 70 6c 69 63 61 |ng a new| applica|
|00000760| 74 69 6f 6e 2e 20 53 61 | 6d 70 6c 65 20 69 73 20 |tion. Sa|mple is |
|00000770| 61 20 73 69 6d 70 6c 65 | 20 61 70 70 2e 20 77 68 |a simple| app. wh|
|00000780| 69 63 68 20 64 6f 65 73 | 6e d5 74 20 0d 23 09 75 |ich does|n.t .#.u|
|00000790| 73 65 20 54 65 78 74 45 | 64 69 74 20 6f 72 20 74 |se TextE|dit or t|
|000007a0| 68 65 20 43 6f 6e 74 72 | 6f 6c 20 4d 61 6e 61 67 |he Contr|ol Manag|
|000007b0| 65 72 2e 0d 23 0d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |er..#.--|--------|
|000007c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000007d0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000007e0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000007f0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000800| 2d 2d 2d 2d 2a 2f 0d 0d | 0d 2f 2a 20 53 65 67 6d |----*/..|./* Segm|
|00000810| 65 6e 74 61 74 69 6f 6e | 20 73 74 72 61 74 65 67 |entation| strateg|
|00000820| 79 3a 0d 0d 20 20 20 54 | 68 69 73 20 70 72 6f 67 |y:.. T|his prog|
|00000830| 72 61 6d 20 63 6f 6e 73 | 69 73 74 73 20 6f 66 20 |ram cons|ists of |
|00000840| 74 68 72 65 65 20 73 65 | 67 6d 65 6e 74 73 2e 20 |three se|gments. |
|00000850| 4d 61 69 6e 20 63 6f 6e | 74 61 69 6e 73 20 6d 6f |Main con|tains mo|
|00000860| 73 74 20 6f 66 20 74 68 | 65 20 63 6f 64 65 2c 0d |st of th|e code,.|
|00000870| 20 20 20 69 6e 63 6c 75 | 64 69 6e 67 20 74 68 65 | inclu|ding the|
|00000880| 20 4d 50 57 20 6c 69 62 | 72 61 72 69 65 73 2c 20 | MPW lib|raries, |
|00000890| 61 6e 64 20 74 68 65 20 | 6d 61 69 6e 20 70 72 6f |and the |main pro|
|000008a0| 67 72 61 6d 2e 20 49 6e | 69 74 69 61 6c 69 7a 65 |gram. In|itialize|
|000008b0| 20 63 6f 6e 74 61 69 6e | 73 0d 20 20 20 63 6f 64 | contain|s. cod|
|000008c0| 65 20 74 68 61 74 20 69 | 73 20 6f 6e 6c 79 20 75 |e that i|s only u|
|000008d0| 73 65 64 20 6f 6e 63 65 | 2c 20 64 75 72 69 6e 67 |sed once|, during|
|000008e0| 20 73 74 61 72 74 75 70 | 2c 20 61 6e 64 20 63 61 | startup|, and ca|
|000008f0| 6e 20 62 65 20 75 6e 6c | 6f 61 64 65 64 20 61 66 |n be unl|oaded af|
|00000900| 74 65 72 20 74 68 65 0d | 20 20 20 70 72 6f 67 72 |ter the.| progr|
|00000910| 61 6d 20 73 74 61 72 74 | 73 2e 20 25 41 35 49 6e |am start|s. %A5In|
|00000920| 69 74 20 69 73 20 61 75 | 74 6f 6d 61 74 69 63 61 |it is au|tomatica|
|00000930| 6c 6c 79 20 63 72 65 61 | 74 65 64 20 62 79 20 74 |lly crea|ted by t|
|00000940| 68 65 20 4c 69 6e 6b 65 | 72 20 74 6f 20 69 6e 69 |he Linke|r to ini|
|00000950| 74 69 61 6c 69 7a 65 0d | 20 20 20 67 6c 6f 62 61 |tialize.| globa|
|00000960| 6c 73 20 66 6f 72 20 74 | 68 65 20 4d 50 57 20 6c |ls for t|he MPW l|
|00000970| 69 62 72 61 72 69 65 73 | 20 61 6e 64 20 69 73 20 |ibraries| and is |
|00000980| 75 6e 6c 6f 61 64 65 64 | 20 72 69 67 68 74 20 61 |unloaded| right a|
|00000990| 77 61 79 2e 20 2a 2f 0d | 0d 0d 2f 2a 20 53 65 74 |way. */.|../* Set|
|000009a0| 50 6f 72 74 20 73 74 72 | 61 74 65 67 79 3a 0d 0d |Port str|ategy:..|
|000009b0| 20 20 20 54 6f 6f 6c 62 | 6f 78 20 72 6f 75 74 69 | Toolb|ox routi|
|000009c0| 6e 65 73 20 64 6f 20 6e | 6f 74 20 63 68 61 6e 67 |nes do n|ot chang|
|000009d0| 65 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 70 6f |e the cu|rrent po|
|000009e0| 72 74 2e 20 49 6e 20 73 | 70 69 74 65 20 6f 66 20 |rt. In s|pite of |
|000009f0| 74 68 69 73 2c 20 69 6e | 20 74 68 69 73 0d 20 20 |this, in| this. |
|00000a00| 20 70 72 6f 67 72 61 6d | 20 77 65 20 75 73 65 20 | program| we use |
|00000a10| 61 20 73 74 72 61 74 65 | 67 79 20 6f 66 20 63 61 |a strate|gy of ca|
|00000a20| 6c 6c 69 6e 67 20 53 65 | 74 50 6f 72 74 20 77 68 |lling Se|tPort wh|
|00000a30| 65 6e 65 76 65 72 20 77 | 65 20 77 61 6e 74 20 74 |enever w|e want t|
|00000a40| 6f 20 64 72 61 77 20 6f | 72 0d 20 20 20 6d 61 6b |o draw o|r. mak|
|00000a50| 65 20 63 61 6c 6c 73 20 | 77 68 69 63 68 20 64 65 |e calls |which de|
|00000a60| 70 65 6e 64 20 6f 6e 20 | 74 68 65 20 63 75 72 72 |pend on |the curr|
|00000a70| 65 6e 74 20 70 6f 72 74 | 2e 20 54 68 69 73 20 6d |ent port|. This m|
|00000a80| 61 6b 65 73 20 75 73 20 | 6c 65 73 73 20 76 75 6c |akes us |less vul|
|00000a90| 6e 65 72 61 62 6c 65 0d | 20 20 20 74 6f 20 62 75 |nerable.| to bu|
|00000aa0| 67 73 20 69 6e 20 6f 74 | 68 65 72 20 73 6f 66 74 |gs in ot|her soft|
|00000ab0| 77 61 72 65 20 77 68 69 | 63 68 20 6d 69 67 68 74 |ware whi|ch might|
|00000ac0| 20 61 6c 74 65 72 20 74 | 68 65 20 63 75 72 72 65 | alter t|he curre|
|00000ad0| 6e 74 20 70 6f 72 74 20 | 28 73 75 63 68 20 61 73 |nt port |(such as|
|00000ae0| 20 74 68 65 0d 20 20 20 | 62 75 67 20 28 66 65 61 | the. |bug (fea|
|00000af0| 74 75 72 65 3f 29 20 69 | 6e 20 6d 61 6e 79 20 64 |ture?) i|n many d|
|00000b00| 65 73 6b 20 61 63 63 65 | 73 73 6f 72 69 65 73 20 |esk acce|ssories |
|00000b10| 77 68 69 63 68 20 63 68 | 61 6e 67 65 20 74 68 65 |which ch|ange the|
|00000b20| 20 70 6f 72 74 20 6f 6e | 20 4f 70 65 6e 44 65 73 | port on| OpenDes|
|00000b30| 6b 41 63 63 29 2e 0d 20 | 20 20 48 6f 70 65 66 75 |kAcc).. | Hopefu|
|00000b40| 6c 6c 79 2c 20 74 68 69 | 73 20 61 6c 73 6f 20 6d |lly, thi|s also m|
|00000b50| 61 6b 65 73 20 74 68 65 | 20 72 6f 75 74 69 6e 65 |akes the| routine|
|00000b60| 73 20 66 72 6f 6d 20 74 | 68 69 73 20 70 72 6f 67 |s from t|his prog|
|00000b70| 72 61 6d 20 6d 6f 72 65 | 20 73 65 6c 66 2d 63 6f |ram more| self-co|
|00000b80| 6e 74 61 69 6e 65 64 2c | 0d 20 20 20 73 69 6e 63 |ntained,|. sinc|
|00000b90| 65 20 74 68 65 79 20 64 | 6f 6e 27 74 20 64 65 70 |e they d|on't dep|
|00000ba0| 65 6e 64 20 6f 6e 20 74 | 68 65 20 63 75 72 72 65 |end on t|he curre|
|00000bb0| 6e 74 20 70 6f 72 74 20 | 73 65 74 74 69 6e 67 2e |nt port |setting.|
|00000bc0| 20 2a 2f 0d 0d 0d 2f 2a | 20 43 6c 69 70 62 6f 61 | */.../*| Clipboa|
|00000bd0| 72 64 20 73 74 72 61 74 | 65 67 79 3a 0d 0d 20 20 |rd strat|egy:.. |
|00000be0| 20 54 68 69 73 20 70 72 | 6f 67 72 61 6d 20 64 6f | This pr|ogram do|
|00000bf0| 65 73 20 6e 6f 74 20 6d | 61 69 6e 74 61 69 6e 20 |es not m|aintain |
|00000c00| 61 20 70 72 69 76 61 74 | 65 20 73 63 72 61 70 2e |a privat|e scrap.|
|00000c10| 20 57 68 65 6e 65 76 65 | 72 20 61 20 63 75 74 2c | Wheneve|r a cut,|
|00000c20| 20 63 6f 70 79 2c 20 6f | 72 20 70 61 73 74 65 0d | copy, o|r paste.|
|00000c30| 20 20 20 6f 63 63 75 72 | 73 2c 20 77 65 20 69 6d | occur|s, we im|
|00000c40| 70 6f 72 74 2f 65 78 70 | 6f 72 74 20 66 72 6f 6d |port/exp|ort from|
|00000c50| 20 74 68 65 20 70 75 62 | 6c 69 63 20 73 63 72 61 | the pub|lic scra|
|00000c60| 70 20 74 6f 20 54 65 78 | 74 45 64 69 74 27 73 20 |p to Tex|tEdit's |
|00000c70| 73 63 72 61 70 20 72 69 | 67 68 74 20 61 77 61 79 |scrap ri|ght away|
|00000c80| 2c 0d 20 20 20 75 73 69 | 6e 67 20 74 68 65 20 54 |,. usi|ng the T|
|00000c90| 45 54 6f 53 63 72 61 70 | 20 61 6e 64 20 54 45 46 |EToScrap| and TEF|
|00000ca0| 72 6f 6d 53 63 72 61 70 | 20 72 6f 75 74 69 6e 65 |romScrap| routine|
|00000cb0| 73 2e 20 49 66 20 77 65 | 20 64 69 64 20 75 73 65 |s. If we| did use|
|00000cc0| 20 61 20 70 72 69 76 61 | 74 65 20 73 63 72 61 70 | a priva|te scrap|
|00000cd0| 2c 0d 20 20 20 74 68 65 | 20 69 6d 70 6f 72 74 2f |,. the| import/|
|00000ce0| 65 78 70 6f 72 74 20 77 | 6f 75 6c 64 20 62 65 20 |export w|ould be |
|00000cf0| 69 6e 20 74 68 65 20 61 | 63 74 69 76 61 74 65 2f |in the a|ctivate/|
|00000d00| 64 65 61 63 74 69 76 61 | 74 65 20 65 76 65 6e 74 |deactiva|te event|
|00000d10| 20 61 6e 64 20 73 75 73 | 70 65 6e 64 2f 72 65 73 | and sus|pend/res|
|00000d20| 75 6d 65 0d 20 20 20 65 | 76 65 6e 74 20 72 6f 75 |ume. e|vent rou|
|00000d30| 74 69 6e 65 73 2e 20 2a | 2f 0d 0d 0d 23 69 6e 63 |tines. *|/...#inc|
|00000d40| 6c 75 64 65 20 3c 56 61 | 6c 75 65 73 2e 68 3e 0d |lude <Va|lues.h>.|
|00000d50| 23 69 6e 63 6c 75 64 65 | 20 3c 54 79 70 65 73 2e |#include| <Types.|
|00000d60| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 51 75 69 |h>.#incl|ude <Qui|
|00000d70| 63 6b 44 72 61 77 2e 68 | 3e 0d 23 69 6e 63 6c 75 |ckDraw.h|>.#inclu|
|00000d80| 64 65 20 3c 46 6f 6e 74 | 73 2e 68 3e 0d 23 69 6e |de <Font|s.h>.#in|
|00000d90| 63 6c 75 64 65 20 3c 45 | 76 65 6e 74 73 2e 68 3e |clude <E|vents.h>|
|00000da0| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 43 6f 6e 74 72 |.#includ|e <Contr|
|00000db0| 6f 6c 73 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |ols.h>.#|include |
|00000dc0| 3c 57 69 6e 64 6f 77 73 | 2e 68 3e 0d 23 69 6e 63 |<Windows|.h>.#inc|
|00000dd0| 6c 75 64 65 20 3c 4d 65 | 6e 75 73 2e 68 3e 0d 23 |lude <Me|nus.h>.#|
|00000de0| 69 6e 63 6c 75 64 65 20 | 3c 54 65 78 74 45 64 69 |include |<TextEdi|
|00000df0| 74 2e 68 3e 0d 23 69 6e | 63 6c 75 64 65 20 3c 44 |t.h>.#in|clude <D|
|00000e00| 69 61 6c 6f 67 73 2e 68 | 3e 0d 23 69 6e 63 6c 75 |ialogs.h|>.#inclu|
|00000e10| 64 65 20 3c 44 65 73 6b | 2e 68 3e 0d 23 69 6e 63 |de <Desk|.h>.#inc|
|00000e20| 6c 75 64 65 20 3c 53 63 | 72 61 70 2e 68 3e 0d 23 |lude <Sc|rap.h>.#|
|00000e30| 69 6e 63 6c 75 64 65 20 | 3c 54 6f 6f 6c 55 74 69 |include |<ToolUti|
|00000e40| 6c 73 2e 68 3e 0d 23 69 | 6e 63 6c 75 64 65 20 3c |ls.h>.#i|nclude <|
|00000e50| 4d 65 6d 6f 72 79 2e 68 | 3e 0d 23 69 6e 63 6c 75 |Memory.h|>.#inclu|
|00000e60| 64 65 20 3c 53 65 67 4c | 6f 61 64 2e 68 3e 0d 23 |de <SegL|oad.h>.#|
|00000e70| 69 6e 63 6c 75 64 65 20 | 3c 46 69 6c 65 73 2e 68 |include |<Files.h|
|00000e80| 3e 0d 23 69 6e 63 6c 75 | 64 65 20 3c 4f 53 55 74 |>.#inclu|de <OSUt|
|00000e90| 69 6c 73 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |ils.h>.#|include |
|00000ea0| 3c 44 69 73 6b 49 6e 69 | 74 2e 68 3e 0d 23 69 6e |<DiskIni|t.h>.#in|
|00000eb0| 63 6c 75 64 65 20 3c 50 | 61 63 6b 61 67 65 73 2e |clude <P|ackages.|
|00000ec0| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 54 72 61 |h>.#incl|ude <Tra|
|00000ed0| 70 73 2e 68 3e 09 09 09 | 2f 2a 20 4d 50 57 20 32 |ps.h>...|/* MPW 2|
|00000ee0| 2e 30 2e 32 20 54 72 61 | 70 73 2e 68 20 69 73 20 |.0.2 Tra|ps.h is |
|00000ef0| 6d 69 73 73 69 6e 67 20 | 61 6e 20 23 65 6e 64 69 |missing |an #endi|
|00000f00| 66 20 2a 2f 0d 23 69 6e | 63 6c 75 64 65 20 3c 54 |f */.#in|clude <T|
|00000f10| 45 53 61 6d 70 6c 65 2e | 68 3e 09 09 2f 2a 20 62 |ESample.|h>../* b|
|00000f20| 72 69 6e 67 20 69 6e 20 | 61 6c 6c 20 74 68 65 20 |ring in |all the |
|00000f30| 23 64 65 66 69 6e 65 73 | 20 66 6f 72 20 53 61 6d |#defines| for Sam|
|00000f40| 70 6c 65 20 2a 2f 0d 0d | 0d 2f 2a 20 41 20 44 6f |ple */..|./* A Do|
|00000f50| 63 75 6d 65 6e 74 52 65 | 63 6f 72 64 20 63 6f 6e |cumentRe|cord con|
|00000f60| 74 61 69 6e 73 20 74 68 | 65 20 57 69 6e 64 6f 77 |tains th|e Window|
|00000f70| 52 65 63 6f 72 64 20 66 | 6f 72 20 6f 6e 65 20 6f |Record f|or one o|
|00000f80| 66 20 6f 75 72 20 64 6f | 63 75 6d 65 6e 74 20 77 |f our do|cument w|
|00000f90| 69 6e 64 6f 77 73 2c 0d | 20 20 20 61 73 20 77 65 |indows,.| as we|
|00000fa0| 6c 6c 20 61 73 20 74 68 | 65 20 54 45 48 61 6e 64 |ll as th|e TEHand|
|00000fb0| 6c 65 20 66 6f 72 20 74 | 68 65 20 74 65 78 74 20 |le for t|he text |
|00000fc0| 77 65 20 61 72 65 20 65 | 64 69 74 69 6e 67 2e 20 |we are e|diting. |
|00000fd0| 4f 74 68 65 72 20 64 6f | 63 75 6d 65 6e 74 20 66 |Other do|cument f|
|00000fe0| 69 65 6c 64 73 0d 20 20 | 20 63 61 6e 20 62 65 20 |ields. | can be |
|00000ff0| 61 64 64 65 64 20 74 6f | 20 74 68 69 73 20 72 65 |added to| this re|
|00001000| 63 6f 72 64 20 61 73 20 | 6e 65 65 64 65 64 2e 20 |cord as |needed. |
|00001010| 46 6f 72 20 61 20 73 69 | 6d 69 6c 61 72 20 65 78 |For a si|milar ex|
|00001020| 61 6d 70 6c 65 2c 20 73 | 65 65 20 68 6f 77 20 74 |ample, s|ee how t|
|00001030| 68 65 0d 20 20 20 57 69 | 6e 64 6f 77 20 4d 61 6e |he. Wi|ndow Man|
|00001040| 61 67 65 72 20 61 6e 64 | 20 44 69 61 6c 6f 67 20 |ager and| Dialog |
|00001050| 4d 61 6e 61 67 65 72 20 | 61 64 64 20 66 69 65 6c |Manager |add fiel|
|00001060| 64 73 20 61 66 74 65 72 | 20 74 68 65 20 47 72 61 |ds after| the Gra|
|00001070| 66 50 6f 72 74 2e 20 2a | 2f 0d 74 79 70 65 64 65 |fPort. *|/.typede|
|00001080| 66 20 73 74 72 75 63 74 | 20 7b 0d 09 57 69 6e 64 |f struct| {..Wind|
|00001090| 6f 77 52 65 63 6f 72 64 | 09 64 6f 63 57 69 6e 64 |owRecord|.docWind|
|000010a0| 6f 77 3b 0d 09 54 45 48 | 61 6e 64 6c 65 09 09 64 |ow;..TEH|andle..d|
|000010b0| 6f 63 54 45 3b 0d 09 43 | 6f 6e 74 72 6f 6c 48 61 |ocTE;..C|ontrolHa|
|000010c0| 6e 64 6c 65 09 64 6f 63 | 56 53 63 72 6f 6c 6c 3b |ndle.doc|VScroll;|
|000010d0| 0d 09 43 6f 6e 74 72 6f | 6c 48 61 6e 64 6c 65 09 |..Contro|lHandle.|
|000010e0| 64 6f 63 48 53 63 72 6f | 6c 6c 3b 0d 09 50 72 6f |docHScro|ll;..Pro|
|000010f0| 63 50 74 72 09 09 09 64 | 6f 63 43 6c 69 6b 3b 0d |cPtr...d|ocClik;.|
|00001100| 7d 20 44 6f 63 75 6d 65 | 6e 74 52 65 63 6f 72 64 |} Docume|ntRecord|
|00001110| 2c 20 2a 44 6f 63 75 6d | 65 6e 74 50 65 65 6b 3b |, *Docum|entPeek;|
|00001120| 0d 0d 0d 0d 2f 2a 20 54 | 68 65 20 22 67 22 20 70 |..../* T|he "g" p|
|00001130| 72 65 66 69 78 20 69 73 | 20 75 73 65 64 20 74 6f |refix is| used to|
|00001140| 20 65 6d 70 68 61 73 69 | 7a 65 20 74 68 61 74 20 | emphasi|ze that |
|00001150| 61 20 76 61 72 69 61 62 | 6c 65 20 69 73 20 67 6c |a variab|le is gl|
|00001160| 6f 62 61 6c 2e 20 2a 2f | 0d 0d 2f 2a 20 47 4d 61 |obal. */|../* GMa|
|00001170| 63 20 69 73 20 75 73 65 | 64 20 74 6f 20 68 6f 6c |c is use|d to hol|
|00001180| 64 20 74 68 65 20 72 65 | 73 75 6c 74 20 6f 66 20 |d the re|sult of |
|00001190| 61 20 53 79 73 45 6e 76 | 69 72 6f 6e 73 20 63 61 |a SysEnv|irons ca|
|000011a0| 6c 6c 2e 20 54 68 69 73 | 20 6d 61 6b 65 73 0d 20 |ll. This| makes. |
|000011b0| 20 20 69 74 20 63 6f 6e | 76 65 6e 69 65 6e 74 20 | it con|venient |
|000011c0| 66 6f 72 20 61 6e 79 20 | 72 6f 75 74 69 6e 65 20 |for any |routine |
|000011d0| 74 6f 20 63 68 65 63 6b | 20 74 68 65 20 65 6e 76 |to check| the env|
|000011e0| 69 72 6f 6e 6d 65 6e 74 | 2e 20 49 74 20 69 73 0d |ironment|. It is.|
|000011f0| 20 20 20 67 6c 6f 62 61 | 6c 20 69 6e 66 6f 72 6d | globa|l inform|
|00001200| 61 74 69 6f 6e 2c 20 61 | 6e 79 77 61 79 2e 20 2a |ation, a|nyway. *|
|00001210| 2f 0d 53 79 73 45 6e 76 | 52 65 63 09 67 4d 61 63 |/.SysEnv|Rec.gMac|
|00001220| 3b 09 09 09 09 2f 2a 20 | 73 65 74 20 75 70 20 62 |;..../* |set up b|
|00001230| 79 20 49 6e 69 74 69 61 | 6c 69 7a 65 20 2a 2f 0d |y Initia|lize */.|
|00001240| 0d 2f 2a 20 47 48 61 73 | 57 61 69 74 4e 65 78 74 |./* GHas|WaitNext|
|00001250| 45 76 65 6e 74 20 69 73 | 20 73 65 74 20 61 74 20 |Event is| set at |
|00001260| 73 74 61 72 74 75 70 2c | 20 61 6e 64 20 74 65 6c |startup,| and tel|
|00001270| 6c 73 20 77 68 65 74 68 | 65 72 20 74 68 65 20 57 |ls wheth|er the W|
|00001280| 61 69 74 4e 65 78 74 45 | 76 65 6e 74 0d 20 20 20 |aitNextE|vent. |
|00001290| 74 72 61 70 20 69 73 20 | 61 76 61 69 6c 61 62 6c |trap is |availabl|
|000012a0| 65 2e 20 49 66 20 69 74 | 20 69 73 20 66 61 6c 73 |e. If it| is fals|
|000012b0| 65 2c 20 77 65 20 6b 6e | 6f 77 20 74 68 61 74 20 |e, we kn|ow that |
|000012c0| 77 65 20 6d 75 73 74 20 | 63 61 6c 6c 20 47 65 74 |we must |call Get|
|000012d0| 4e 65 78 74 45 76 65 6e | 74 2e 20 2a 2f 0d 42 6f |NextEven|t. */.Bo|
|000012e0| 6f 6c 65 61 6e 09 09 67 | 48 61 73 57 61 69 74 4e |olean..g|HasWaitN|
|000012f0| 65 78 74 45 76 65 6e 74 | 3b 09 2f 2a 20 73 65 74 |extEvent|;./* set|
|00001300| 20 75 70 20 62 79 20 49 | 6e 69 74 69 61 6c 69 7a | up by I|nitializ|
|00001310| 65 20 2a 2f 0d 0d 2f 2a | 20 47 49 6e 42 61 63 6b |e */../*| GInBack|
|00001320| 67 72 6f 75 6e 64 20 69 | 73 20 6d 61 69 6e 74 61 |ground i|s mainta|
|00001330| 69 6e 65 64 20 62 79 20 | 6f 75 72 20 4f 53 45 76 |ined by |our OSEv|
|00001340| 65 6e 74 20 68 61 6e 64 | 6c 69 6e 67 20 72 6f 75 |ent hand|ling rou|
|00001350| 74 69 6e 65 73 2e 20 41 | 6e 79 20 70 61 72 74 20 |tines. A|ny part |
|00001360| 6f 66 0d 20 20 20 74 68 | 65 20 70 72 6f 67 72 61 |of. th|e progra|
|00001370| 6d 20 63 61 6e 20 63 68 | 65 63 6b 20 69 74 20 74 |m can ch|eck it t|
|00001380| 6f 20 66 69 6e 64 20 6f | 75 74 20 69 66 20 69 74 |o find o|ut if it|
|00001390| 20 69 73 20 63 75 72 72 | 65 6e 74 6c 79 20 69 6e | is curr|ently in|
|000013a0| 20 74 68 65 20 62 61 63 | 6b 67 72 6f 75 6e 64 2e | the bac|kground.|
|000013b0| 20 2a 2f 0d 42 6f 6f 6c | 65 61 6e 09 09 67 49 6e | */.Bool|ean..gIn|
|000013c0| 42 61 63 6b 67 72 6f 75 | 6e 64 3b 09 09 2f 2a 20 |Backgrou|nd;../* |
|000013d0| 6d 61 69 6e 74 61 69 6e | 65 64 20 62 79 20 49 6e |maintain|ed by In|
|000013e0| 69 74 69 61 6c 69 7a 65 | 20 61 6e 64 20 44 6f 45 |itialize| and DoE|
|000013f0| 76 65 6e 74 20 2a 2f 0d | 0d 2f 2a 20 47 4e 75 6d |vent */.|./* GNum|
|00001400| 44 6f 63 75 6d 65 6e 74 | 73 20 69 73 20 75 73 65 |Document|s is use|
|00001410| 64 20 74 6f 20 6b 65 65 | 70 20 74 72 61 63 6b 20 |d to kee|p track |
|00001420| 6f 66 20 68 6f 77 20 6d | 61 6e 79 20 6f 70 65 6e |of how m|any open|
|00001430| 20 64 6f 63 75 6d 65 6e | 74 73 20 74 68 65 72 65 | documen|ts there|
|00001440| 20 61 72 65 0d 20 20 20 | 61 74 20 61 6e 79 20 74 | are. |at any t|
|00001450| 69 6d 65 2e 20 49 74 20 | 69 73 20 6d 61 69 6e 74 |ime. It |is maint|
|00001460| 61 69 6e 65 64 20 62 79 | 20 74 68 65 20 72 6f 75 |ained by| the rou|
|00001470| 74 69 6e 65 73 20 74 68 | 61 74 20 6f 70 65 6e 20 |tines th|at open |
|00001480| 61 6e 64 20 63 6c 6f 73 | 65 20 64 6f 63 75 6d 65 |and clos|e docume|
|00001490| 6e 74 73 2e 20 2a 2f 0d | 73 68 6f 72 74 09 09 67 |nts. */.|short..g|
|000014a0| 4e 75 6d 44 6f 63 75 6d | 65 6e 74 73 3b 09 09 2f |NumDocum|ents;../|
|000014b0| 2a 20 6d 61 69 6e 74 61 | 69 6e 65 64 20 62 79 20 |* mainta|ined by |
|000014c0| 49 6e 69 74 69 61 6c 69 | 7a 65 2c 20 44 6f 4e 65 |Initiali|ze, DoNe|
|000014d0| 77 2c 20 61 6e 64 20 44 | 6f 43 6c 6f 73 65 57 69 |w, and D|oCloseWi|
|000014e0| 6e 64 6f 77 20 2a 2f 0d | 0d 0d 2f 2a 20 48 65 72 |ndow */.|../* Her|
|000014f0| 65 20 61 72 65 20 64 65 | 63 6c 61 72 61 74 69 6f |e are de|claratio|
|00001500| 6e 73 20 66 6f 72 20 61 | 6c 6c 20 6f 66 20 74 68 |ns for a|ll of th|
|00001510| 65 20 43 20 72 6f 75 74 | 69 6e 65 73 2e 20 49 6e |e C rout|ines. In|
|00001520| 20 4d 50 57 20 33 2e 30 | 20 77 65 20 63 61 6e 20 | MPW 3.0| we can |
|00001530| 75 73 65 0d 20 20 20 61 | 63 74 75 61 6c 20 70 72 |use. a|ctual pr|
|00001540| 6f 74 6f 74 79 70 65 73 | 20 66 6f 72 20 70 61 72 |ototypes| for par|
|00001550| 61 6d 65 74 65 72 20 74 | 79 70 65 20 63 68 65 63 |ameter t|ype chec|
|00001560| 6b 69 6e 67 2e 20 2a 2f | 0d 23 69 66 6e 64 65 66 |king. */|.#ifndef|
|00001570| 20 4d 50 57 33 0d 09 76 | 6f 69 64 20 41 6c 65 72 | MPW3..v|oid Aler|
|00001580| 74 55 73 65 72 28 20 2f | 2a 20 73 68 6f 72 74 20 |tUser( /|* short |
|00001590| 65 72 72 6f 72 20 2a 2f | 20 29 3b 0d 09 76 6f 69 |error */| );..voi|
|000015a0| 64 20 45 76 65 6e 74 4c | 6f 6f 70 28 29 3b 0d 09 |d EventL|oop();..|
|000015b0| 76 6f 69 64 20 44 6f 45 | 76 65 6e 74 28 20 2f 2a |void DoE|vent( /*|
|000015c0| 20 45 76 65 6e 74 52 65 | 63 6f 72 64 20 2a 65 76 | EventRe|cord *ev|
|000015d0| 65 6e 74 20 2a 2f 20 29 | 3b 0d 09 76 6f 69 64 20 |ent */ )|;..void |
|000015e0| 41 64 6a 75 73 74 43 75 | 72 73 6f 72 28 20 2f 2a |AdjustCu|rsor( /*|
|000015f0| 20 50 6f 69 6e 74 20 6d | 6f 75 73 65 2c 20 52 67 | Point m|ouse, Rg|
|00001600| 6e 48 61 6e 64 6c 65 20 | 72 65 67 69 6f 6e 20 2a |nHandle |region *|
|00001610| 2f 20 29 3b 0d 09 76 6f | 69 64 20 44 6f 47 72 6f |/ );..vo|id DoGro|
|00001620| 77 57 69 6e 64 6f 77 28 | 20 2f 2a 20 57 69 6e 64 |wWindow(| /* Wind|
|00001630| 6f 77 50 74 72 20 77 69 | 6e 64 6f 77 2c 20 45 76 |owPtr wi|ndow, Ev|
|00001640| 65 6e 74 52 65 63 6f 72 | 64 20 2a 65 76 65 6e 74 |entRecor|d *event|
|00001650| 20 2a 2f 20 29 3b 0d 09 | 76 6f 69 64 20 44 6f 5a | */ );..|void DoZ|
|00001660| 6f 6f 6d 57 69 6e 64 6f | 77 28 20 2f 2a 20 57 69 |oomWindo|w( /* Wi|
|00001670| 6e 64 6f 77 50 74 72 20 | 77 69 6e 64 6f 77 2c 20 |ndowPtr |window, |
|00001680| 73 68 6f 72 74 20 70 61 | 72 74 20 2a 2f 20 29 3b |short pa|rt */ );|
|00001690| 0d 09 76 6f 69 64 20 52 | 65 73 69 7a 65 57 69 6e |..void R|esizeWin|
|000016a0| 64 6f 77 28 20 2f 2a 20 | 57 69 6e 64 6f 77 50 74 |dow( /* |WindowPt|
|000016b0| 72 20 77 69 6e 64 6f 77 | 20 2a 2f 20 29 3b 0d 09 |r window| */ );..|
|000016c0| 76 6f 69 64 20 47 65 74 | 4c 6f 63 61 6c 55 70 64 |void Get|LocalUpd|
|000016d0| 61 74 65 52 67 6e 28 20 | 2f 2a 20 57 69 6e 64 6f |ateRgn( |/* Windo|
|000016e0| 77 50 74 72 20 77 69 6e | 64 6f 77 2c 20 52 67 6e |wPtr win|dow, Rgn|
|000016f0| 48 61 6e 64 6c 65 20 6c | 6f 63 61 6c 52 67 6e 20 |Handle l|ocalRgn |
|00001700| 2a 2f 20 29 3b 0d 09 76 | 6f 69 64 20 44 6f 55 70 |*/ );..v|oid DoUp|
|00001710| 64 61 74 65 28 20 2f 2a | 20 57 69 6e 64 6f 77 50 |date( /*| WindowP|
|00001720| 74 72 20 77 69 6e 64 6f | 77 20 2a 2f 20 29 3b 0d |tr windo|w */ );.|
|00001730| 09 76 6f 69 64 20 44 6f | 44 65 61 63 74 69 76 61 |.void Do|Deactiva|
|00001740| 74 65 28 20 2f 2a 20 57 | 69 6e 64 6f 77 50 74 72 |te( /* W|indowPtr|
|00001750| 20 77 69 6e 64 6f 77 20 | 2a 2f 20 29 3b 0d 09 76 | window |*/ );..v|
|00001760| 6f 69 64 20 44 6f 41 63 | 74 69 76 61 74 65 28 20 |oid DoAc|tivate( |
|00001770| 2f 2a 20 57 69 6e 64 6f | 77 50 74 72 20 77 69 6e |/* Windo|wPtr win|
|00001780| 64 6f 77 2c 20 42 6f 6f | 6c 65 61 6e 20 62 65 63 |dow, Boo|lean bec|
|00001790| 6f 6d 69 6e 67 41 63 74 | 69 76 65 20 2a 2f 20 29 |omingAct|ive */ )|
|000017a0| 3b 0d 09 76 6f 69 64 20 | 44 6f 43 6f 6e 74 65 6e |;..void |DoConten|
|000017b0| 74 43 6c 69 63 6b 28 20 | 2f 2a 20 57 69 6e 64 6f |tClick( |/* Windo|
|000017c0| 77 50 74 72 20 77 69 6e | 64 6f 77 2c 20 45 76 65 |wPtr win|dow, Eve|
|000017d0| 6e 74 52 65 63 6f 72 64 | 20 2a 65 76 65 6e 74 20 |ntRecord| *event |
|000017e0| 2a 2f 20 29 3b 0d 09 76 | 6f 69 64 20 44 6f 4b 65 |*/ );..v|oid DoKe|
|000017f0| 79 44 6f 77 6e 28 20 2f | 2a 20 45 76 65 6e 74 52 |yDown( /|* EventR|
|00001800| 65 63 6f 72 64 20 2a 65 | 76 65 6e 74 20 2a 2f 20 |ecord *e|vent */ |
|00001810| 29 3b 0d 09 75 6e 73 69 | 67 6e 65 64 20 6c 6f 6e |);..unsi|gned lon|
|00001820| 67 20 47 65 74 53 6c 65 | 65 70 28 29 3b 0d 09 76 |g GetSle|ep();..v|
|00001830| 6f 69 64 20 43 6f 6d 6d | 6f 6e 41 63 74 69 6f 6e |oid Comm|onAction|
|00001840| 28 20 2f 2a 20 43 6f 6e | 74 72 6f 6c 48 61 6e 64 |( /* Con|trolHand|
|00001850| 6c 65 20 63 6f 6e 74 72 | 6f 6c 2c 20 73 68 6f 72 |le contr|ol, shor|
|00001860| 74 20 2a 61 6d 6f 75 6e | 74 20 2a 2f 20 29 3b 0d |t *amoun|t */ );.|
|00001870| 09 70 61 73 63 61 6c 20 | 76 6f 69 64 20 56 41 63 |.pascal |void VAc|
|00001880| 74 69 6f 6e 50 72 6f 63 | 28 20 2f 2a 20 43 6f 6e |tionProc|( /* Con|
|00001890| 74 72 6f 6c 48 61 6e 64 | 6c 65 20 63 6f 6e 74 72 |trolHand|le contr|
|000018a0| 6f 6c 2c 20 73 68 6f 72 | 74 20 70 61 72 74 20 2a |ol, shor|t part *|
|000018b0| 2f 20 29 3b 0d 09 70 61 | 73 63 61 6c 20 76 6f 69 |/ );..pa|scal voi|
|000018c0| 64 20 48 41 63 74 69 6f | 6e 50 72 6f 63 28 20 2f |d HActio|nProc( /|
|000018d0| 2a 20 43 6f 6e 74 72 6f | 6c 48 61 6e 64 6c 65 20 |* Contro|lHandle |
|000018e0| 63 6f 6e 74 72 6f 6c 2c | 20 73 68 6f 72 74 20 70 |control,| short p|
|000018f0| 61 72 74 20 2a 2f 20 29 | 3b 0d 09 76 6f 69 64 20 |art */ )|;..void |
|00001900| 44 6f 49 64 6c 65 28 29 | 3b 0d 09 76 6f 69 64 20 |DoIdle()|;..void |
|00001910| 44 72 61 77 57 69 6e 64 | 6f 77 28 20 2f 2a 20 57 |DrawWind|ow( /* W|
|00001920| 69 6e 64 6f 77 50 74 72 | 20 77 69 6e 64 6f 77 20 |indowPtr| window |
|00001930| 2a 2f 20 29 3b 0d 09 76 | 6f 69 64 20 41 64 6a 75 |*/ );..v|oid Adju|
|00001940| 73 74 4d 65 6e 75 73 28 | 29 3b 0d 09 76 6f 69 64 |stMenus(|);..void|
|00001950| 20 44 6f 4d 65 6e 75 43 | 6f 6d 6d 61 6e 64 28 20 | DoMenuC|ommand( |
|00001960| 2f 2a 20 6c 6f 6e 67 20 | 6d 65 6e 75 52 65 73 75 |/* long |menuResu|
|00001970| 6c 74 20 2a 2f 20 29 3b | 0d 09 76 6f 69 64 20 44 |lt */ );|..void D|
|00001980| 6f 4e 65 77 28 29 3b 0d | 09 42 6f 6f 6c 65 61 6e |oNew();.|.Boolean|
|00001990| 20 44 6f 43 6c 6f 73 65 | 57 69 6e 64 6f 77 28 20 | DoClose|Window( |
|000019a0| 2f 2a 20 57 69 6e 64 6f | 77 50 74 72 20 77 69 6e |/* Windo|wPtr win|
|000019b0| 64 6f 77 20 2a 2f 20 29 | 3b 0d 09 76 6f 69 64 20 |dow */ )|;..void |
|000019c0| 54 65 72 6d 69 6e 61 74 | 65 28 29 3b 0d 09 76 6f |Terminat|e();..vo|
|000019d0| 69 64 20 49 6e 69 74 69 | 61 6c 69 7a 65 28 29 3b |id Initi|alize();|
|000019e0| 0d 09 76 6f 69 64 20 42 | 69 67 42 61 64 45 72 72 |..void B|igBadErr|
|000019f0| 6f 72 28 20 2f 2a 20 65 | 72 72 6f 72 20 2a 2f 20 |or( /* e|rror */ |
|00001a00| 29 3b 0d 09 76 6f 69 64 | 20 47 65 74 54 45 52 65 |);..void| GetTERe|
|00001a10| 63 74 28 20 2f 2a 20 57 | 69 6e 64 6f 77 50 74 72 |ct( /* W|indowPtr|
|00001a20| 20 77 69 6e 64 6f 77 2c | 20 52 65 63 74 20 2a 74 | window,| Rect *t|
|00001a30| 65 52 65 63 74 20 2a 2f | 20 29 3b 0d 09 76 6f 69 |eRect */| );..voi|
|00001a40| 64 20 41 64 6a 75 73 74 | 56 69 65 77 52 65 63 74 |d Adjust|ViewRect|
|00001a50| 28 20 2f 2a 20 54 45 48 | 61 6e 64 6c 65 20 64 6f |( /* TEH|andle do|
|00001a60| 63 54 45 20 2a 2f 20 29 | 3b 0d 09 76 6f 69 64 20 |cTE */ )|;..void |
|00001a70| 41 64 6a 75 73 74 54 45 | 28 20 2f 2a 20 57 69 6e |AdjustTE|( /* Win|
|00001a80| 64 6f 77 50 74 72 20 77 | 69 6e 64 6f 77 20 2a 2f |dowPtr w|indow */|
|00001a90| 20 29 3b 0d 09 76 6f 69 | 64 20 41 64 6a 75 73 74 | );..voi|d Adjust|
|00001aa0| 48 56 28 20 2f 2a 20 42 | 6f 6f 6c 65 61 6e 20 69 |HV( /* B|oolean i|
|00001ab0| 73 56 65 72 74 2c 20 43 | 6f 6e 74 72 6f 6c 48 61 |sVert, C|ontrolHa|
|00001ac0| 6e 64 6c 65 20 63 6f 6e | 74 72 6f 6c 2c 20 54 45 |ndle con|trol, TE|
|00001ad0| 48 61 6e 64 6c 65 20 64 | 6f 63 54 45 2c 0d 09 09 |Handle d|ocTE,...|
|00001ae0| 09 09 09 42 6f 6f 6c 65 | 61 6e 20 63 61 6e 52 65 |...Boole|an canRe|
|00001af0| 64 72 61 77 20 2a 2f 20 | 29 3b 0d 09 76 6f 69 64 |draw */ |);..void|
|00001b00| 20 41 64 6a 75 73 74 53 | 63 72 6f 6c 6c 56 61 6c | AdjustS|crollVal|
|00001b10| 75 65 73 28 20 2f 2a 20 | 57 69 6e 64 6f 77 50 74 |ues( /* |WindowPt|
|00001b20| 72 20 77 69 6e 64 6f 77 | 2c 20 42 6f 6f 6c 65 61 |r window|, Boolea|
|00001b30| 6e 20 63 61 6e 52 65 64 | 72 61 77 20 2a 2f 20 29 |n canRed|raw */ )|
|00001b40| 3b 0d 09 76 6f 69 64 20 | 41 64 6a 75 73 74 53 63 |;..void |AdjustSc|
|00001b50| 72 6f 6c 6c 53 69 7a 65 | 73 28 20 2f 2a 20 57 69 |rollSize|s( /* Wi|
|00001b60| 6e 64 6f 77 50 74 72 20 | 77 69 6e 64 6f 77 20 2a |ndowPtr |window *|
|00001b70| 2f 20 29 3b 0d 09 76 6f | 69 64 20 41 64 6a 75 73 |/ );..vo|id Adjus|
|00001b80| 74 53 63 72 6f 6c 6c 62 | 61 72 73 28 20 2f 2a 20 |tScrollb|ars( /* |
|00001b90| 57 69 6e 64 6f 77 50 74 | 72 20 77 69 6e 64 6f 77 |WindowPt|r window|
|00001ba0| 2c 20 42 6f 6f 6c 65 61 | 6e 20 6e 65 65 64 73 52 |, Boolea|n needsR|
|00001bb0| 65 73 69 7a 65 20 2a 2f | 20 29 3b 0d 09 70 61 73 |esize */| );..pas|
|00001bc0| 63 61 6c 20 76 6f 69 64 | 20 50 61 73 63 61 6c 43 |cal void| PascalC|
|00001bd0| 6c 69 6b 4c 6f 6f 70 28 | 29 3b 0d 09 70 61 73 63 |likLoop(|);..pasc|
|00001be0| 61 6c 20 50 72 6f 63 50 | 74 72 20 47 65 74 4f 6c |al ProcP|tr GetOl|
|00001bf0| 64 43 6c 69 6b 4c 6f 6f | 70 28 29 3b 0d 09 42 6f |dClikLoo|p();..Bo|
|00001c00| 6f 6c 65 61 6e 20 49 73 | 41 70 70 57 69 6e 64 6f |olean Is|AppWindo|
|00001c10| 77 28 20 2f 2a 20 57 69 | 6e 64 6f 77 50 74 72 20 |w( /* Wi|ndowPtr |
|00001c20| 77 69 6e 64 6f 77 20 2a | 2f 20 29 3b 0d 09 42 6f |window *|/ );..Bo|
|00001c30| 6f 6c 65 61 6e 20 49 73 | 44 41 57 69 6e 64 6f 77 |olean Is|DAWindow|
|00001c40| 28 20 2f 2a 20 57 69 6e | 64 6f 77 50 74 72 20 77 |( /* Win|dowPtr w|
|00001c50| 69 6e 64 6f 77 20 2a 2f | 20 29 3b 0d 09 42 6f 6f |indow */| );..Boo|
|00001c60| 6c 65 61 6e 20 54 72 61 | 70 41 76 61 69 6c 61 62 |lean Tra|pAvailab|
|00001c70| 6c 65 28 20 2f 2a 20 73 | 68 6f 72 74 20 74 4e 75 |le( /* s|hort tNu|
|00001c80| 6d 62 65 72 2c 20 54 72 | 61 70 54 79 70 65 20 74 |mber, Tr|apType t|
|00001c90| 54 79 70 65 20 2a 2f 20 | 29 3b 0d 23 65 6c 73 65 |Type */ |);.#else|
|00001ca0| 0d 09 76 6f 69 64 20 41 | 6c 65 72 74 55 73 65 72 |..void A|lertUser|
|00001cb0| 28 20 73 68 6f 72 74 20 | 65 72 72 6f 72 20 29 3b |( short |error );|
|00001cc0| 0d 09 76 6f 69 64 20 45 | 76 65 6e 74 4c 6f 6f 70 |..void E|ventLoop|
|00001cd0| 28 20 76 6f 69 64 20 29 | 3b 0d 09 76 6f 69 64 20 |( void )|;..void |
|00001ce0| 44 6f 45 76 65 6e 74 28 | 20 45 76 65 6e 74 52 65 |DoEvent(| EventRe|
|00001cf0| 63 6f 72 64 20 2a 65 76 | 65 6e 74 20 29 3b 0d 09 |cord *ev|ent );..|
|00001d00| 76 6f 69 64 20 41 64 6a | 75 73 74 43 75 72 73 6f |void Adj|ustCurso|
|00001d10| 72 28 20 50 6f 69 6e 74 | 20 6d 6f 75 73 65 2c 20 |r( Point| mouse, |
|00001d20| 52 67 6e 48 61 6e 64 6c | 65 20 72 65 67 69 6f 6e |RgnHandl|e region|
|00001d30| 20 29 3b 0d 09 76 6f 69 | 64 20 44 6f 47 72 6f 77 | );..voi|d DoGrow|
|00001d40| 57 69 6e 64 6f 77 28 20 | 57 69 6e 64 6f 77 50 74 |Window( |WindowPt|
|00001d50| 72 20 77 69 6e 64 6f 77 | 2c 20 45 76 65 6e 74 52 |r window|, EventR|
|00001d60| 65 63 6f 72 64 20 2a 65 | 76 65 6e 74 20 29 3b 0d |ecord *e|vent );.|
|00001d70| 09 76 6f 69 64 20 44 6f | 5a 6f 6f 6d 57 69 6e 64 |.void Do|ZoomWind|
|00001d80| 6f 77 28 20 57 69 6e 64 | 6f 77 50 74 72 20 77 69 |ow( Wind|owPtr wi|
|00001d90| 6e 64 6f 77 2c 20 73 68 | 6f 72 74 20 70 61 72 74 |ndow, sh|ort part|
|00001da0| 20 29 3b 0d 09 76 6f 69 | 64 20 52 65 73 69 7a 65 | );..voi|d Resize|
|00001db0| 57 69 6e 64 6f 77 28 20 | 57 69 6e 64 6f 77 50 74 |Window( |WindowPt|
|00001dc0| 72 20 77 69 6e 64 6f 77 | 20 29 3b 0d 09 76 6f 69 |r window| );..voi|
|00001dd0| 64 20 47 65 74 4c 6f 63 | 61 6c 55 70 64 61 74 65 |d GetLoc|alUpdate|
|00001de0| 52 67 6e 28 20 57 69 6e | 64 6f 77 50 74 72 20 77 |Rgn( Win|dowPtr w|
|00001df0| 69 6e 64 6f 77 2c 20 52 | 67 6e 48 61 6e 64 6c 65 |indow, R|gnHandle|
|00001e00| 20 6c 6f 63 61 6c 52 67 | 6e 20 29 3b 0d 09 76 6f | localRg|n );..vo|
|00001e10| 69 64 20 44 6f 55 70 64 | 61 74 65 28 20 57 69 6e |id DoUpd|ate( Win|
|00001e20| 64 6f 77 50 74 72 20 77 | 69 6e 64 6f 77 20 29 3b |dowPtr w|indow );|
|00001e30| 0d 09 76 6f 69 64 20 44 | 6f 44 65 61 63 74 69 76 |..void D|oDeactiv|
|00001e40| 61 74 65 28 20 57 69 6e | 64 6f 77 50 74 72 20 77 |ate( Win|dowPtr w|
|00001e50| 69 6e 64 6f 77 20 29 3b | 0d 09 76 6f 69 64 20 44 |indow );|..void D|
|00001e60| 6f 41 63 74 69 76 61 74 | 65 28 20 57 69 6e 64 6f |oActivat|e( Windo|
|00001e70| 77 50 74 72 20 77 69 6e | 64 6f 77 2c 20 42 6f 6f |wPtr win|dow, Boo|
|00001e80| 6c 65 61 6e 20 62 65 63 | 6f 6d 69 6e 67 41 63 74 |lean bec|omingAct|
|00001e90| 69 76 65 20 29 3b 0d 09 | 76 6f 69 64 20 44 6f 43 |ive );..|void DoC|
|00001ea0| 6f 6e 74 65 6e 74 43 6c | 69 63 6b 28 20 57 69 6e |ontentCl|ick( Win|
|00001eb0| 64 6f 77 50 74 72 20 77 | 69 6e 64 6f 77 2c 20 45 |dowPtr w|indow, E|
|00001ec0| 76 65 6e 74 52 65 63 6f | 72 64 20 2a 65 76 65 6e |ventReco|rd *even|
|00001ed0| 74 20 29 3b 0d 09 76 6f | 69 64 20 44 6f 4b 65 79 |t );..vo|id DoKey|
|00001ee0| 44 6f 77 6e 28 20 45 76 | 65 6e 74 52 65 63 6f 72 |Down( Ev|entRecor|
|00001ef0| 64 20 2a 65 76 65 6e 74 | 20 29 3b 0d 09 75 6e 73 |d *event| );..uns|
|00001f00| 69 67 6e 65 64 20 6c 6f | 6e 67 20 47 65 74 53 6c |igned lo|ng GetSl|
|00001f10| 65 65 70 28 20 76 6f 69 | 64 20 29 3b 0d 09 76 6f |eep( voi|d );..vo|
|00001f20| 69 64 20 43 6f 6d 6d 6f | 6e 41 63 74 69 6f 6e 28 |id Commo|nAction(|
|00001f30| 20 43 6f 6e 74 72 6f 6c | 48 61 6e 64 6c 65 20 63 | Control|Handle c|
|00001f40| 6f 6e 74 72 6f 6c 2c 20 | 73 68 6f 72 74 20 2a 61 |ontrol, |short *a|
|00001f50| 6d 6f 75 6e 74 20 29 3b | 0d 09 70 61 73 63 61 6c |mount );|..pascal|
|00001f60| 20 76 6f 69 64 20 56 41 | 63 74 69 6f 6e 50 72 6f | void VA|ctionPro|
|00001f70| 63 28 20 43 6f 6e 74 72 | 6f 6c 48 61 6e 64 6c 65 |c( Contr|olHandle|
|00001f80| 20 63 6f 6e 74 72 6f 6c | 2c 20 73 68 6f 72 74 20 | control|, short |
|00001f90| 70 61 72 74 20 29 3b 0d | 09 70 61 73 63 61 6c 20 |part );.|.pascal |
|00001fa0| 76 6f 69 64 20 48 41 63 | 74 69 6f 6e 50 72 6f 63 |void HAc|tionProc|
|00001fb0| 28 20 43 6f 6e 74 72 6f | 6c 48 61 6e 64 6c 65 20 |( Contro|lHandle |
|00001fc0| 63 6f 6e 74 72 6f 6c 2c | 20 73 68 6f 72 74 20 70 |control,| short p|
|00001fd0| 61 72 74 20 29 3b 0d 09 | 76 6f 69 64 20 44 6f 49 |art );..|void DoI|
|00001fe0| 64 6c 65 28 20 76 6f 69 | 64 20 29 3b 0d 09 76 6f |dle( voi|d );..vo|
|00001ff0| 69 64 20 44 72 61 77 57 | 69 6e 64 6f 77 28 20 57 |id DrawW|indow( W|
|00002000| 69 6e 64 6f 77 50 74 72 | 20 77 69 6e 64 6f 77 20 |indowPtr| window |
|00002010| 29 3b 0d 09 76 6f 69 64 | 20 41 64 6a 75 73 74 4d |);..void| AdjustM|
|00002020| 65 6e 75 73 28 20 76 6f | 69 64 20 29 3b 0d 09 76 |enus( vo|id );..v|
|00002030| 6f 69 64 20 44 6f 4d 65 | 6e 75 43 6f 6d 6d 61 6e |oid DoMe|nuComman|
|00002040| 64 28 20 6c 6f 6e 67 20 | 6d 65 6e 75 52 65 73 75 |d( long |menuResu|
|00002050| 6c 74 20 29 3b 0d 09 76 | 6f 69 64 20 44 6f 4e 65 |lt );..v|oid DoNe|
|00002060| 77 28 20 76 6f 69 64 20 | 29 3b 0d 09 42 6f 6f 6c |w( void |);..Bool|
|00002070| 65 61 6e 20 44 6f 43 6c | 6f 73 65 57 69 6e 64 6f |ean DoCl|oseWindo|
|00002080| 77 28 20 57 69 6e 64 6f | 77 50 74 72 20 77 69 6e |w( Windo|wPtr win|
|00002090| 64 6f 77 20 29 3b 0d 09 | 76 6f 69 64 20 54 65 72 |dow );..|void Ter|
|000020a0| 6d 69 6e 61 74 65 28 20 | 76 6f 69 64 20 29 3b 0d |minate( |void );.|
|000020b0| 09 76 6f 69 64 20 49 6e | 69 74 69 61 6c 69 7a 65 |.void In|itialize|
|000020c0| 28 20 76 6f 69 64 20 29 | 3b 0d 09 76 6f 69 64 20 |( void )|;..void |
|000020d0| 42 69 67 42 61 64 45 72 | 72 6f 72 28 20 73 68 6f |BigBadEr|ror( sho|
|000020e0| 72 74 20 65 72 72 6f 72 | 20 29 3b 0d 09 76 6f 69 |rt error| );..voi|
|000020f0| 64 20 47 65 74 54 45 52 | 65 63 74 28 20 57 69 6e |d GetTER|ect( Win|
|00002100| 64 6f 77 50 74 72 20 77 | 69 6e 64 6f 77 2c 20 52 |dowPtr w|indow, R|
|00002110| 65 63 74 20 2a 74 65 52 | 65 63 74 20 29 3b 0d 09 |ect *teR|ect );..|
|00002120| 76 6f 69 64 20 41 64 6a | 75 73 74 56 69 65 77 52 |void Adj|ustViewR|
|00002130| 65 63 74 28 20 54 45 48 | 61 6e 64 6c 65 20 64 6f |ect( TEH|andle do|
|00002140| 63 54 45 20 29 3b 0d 09 | 76 6f 69 64 20 41 64 6a |cTE );..|void Adj|
|00002150| 75 73 74 54 45 28 20 57 | 69 6e 64 6f 77 50 74 72 |ustTE( W|indowPtr|
|00002160| 20 77 69 6e 64 6f 77 20 | 29 3b 0d 09 76 6f 69 64 | window |);..void|
|00002170| 20 41 64 6a 75 73 74 48 | 56 28 20 42 6f 6f 6c 65 | AdjustH|V( Boole|
|00002180| 61 6e 20 69 73 56 65 72 | 74 2c 20 43 6f 6e 74 72 |an isVer|t, Contr|
|00002190| 6f 6c 48 61 6e 64 6c 65 | 20 63 6f 6e 74 72 6f 6c |olHandle| control|
|000021a0| 2c 20 54 45 48 61 6e 64 | 6c 65 20 64 6f 63 54 45 |, TEHand|le docTE|
|000021b0| 2c 0d 09 09 09 09 09 42 | 6f 6f 6c 65 61 6e 20 63 |,......B|oolean c|
|000021c0| 61 6e 52 65 64 72 61 77 | 20 29 3b 0d 09 76 6f 69 |anRedraw| );..voi|
|000021d0| 64 20 41 64 6a 75 73 74 | 53 63 72 6f 6c 6c 56 61 |d Adjust|ScrollVa|
|000021e0| 6c 75 65 73 28 20 57 69 | 6e 64 6f 77 50 74 72 20 |lues( Wi|ndowPtr |
|000021f0| 77 69 6e 64 6f 77 2c 20 | 42 6f 6f 6c 65 61 6e 20 |window, |Boolean |
|00002200| 63 61 6e 52 65 64 72 61 | 77 20 29 3b 0d 09 76 6f |canRedra|w );..vo|
|00002210| 69 64 20 41 64 6a 75 73 | 74 53 63 72 6f 6c 6c 53 |id Adjus|tScrollS|
|00002220| 69 7a 65 73 28 20 57 69 | 6e 64 6f 77 50 74 72 20 |izes( Wi|ndowPtr |
|00002230| 77 69 6e 64 6f 77 20 29 | 3b 0d 09 76 6f 69 64 20 |window )|;..void |
|00002240| 41 64 6a 75 73 74 53 63 | 72 6f 6c 6c 62 61 72 73 |AdjustSc|rollbars|
|00002250| 28 20 57 69 6e 64 6f 77 | 50 74 72 20 77 69 6e 64 |( Window|Ptr wind|
|00002260| 6f 77 2c 20 42 6f 6f 6c | 65 61 6e 20 6e 65 65 64 |ow, Bool|ean need|
|00002270| 73 52 65 73 69 7a 65 20 | 29 3b 0d 09 70 61 73 63 |sResize |);..pasc|
|00002280| 61 6c 20 76 6f 69 64 20 | 50 61 73 63 61 6c 43 6c |al void |PascalCl|
|00002290| 69 6b 4c 6f 6f 70 28 29 | 3b 0d 09 70 61 73 63 61 |ikLoop()|;..pasca|
|000022a0| 6c 20 50 72 6f 63 50 74 | 72 20 47 65 74 4f 6c 64 |l ProcPt|r GetOld|
|000022b0| 43 6c 69 6b 4c 6f 6f 70 | 28 29 3b 0d 09 42 6f 6f |ClikLoop|();..Boo|
|000022c0| 6c 65 61 6e 20 49 73 41 | 70 70 57 69 6e 64 6f 77 |lean IsA|ppWindow|
|000022d0| 28 20 57 69 6e 64 6f 77 | 50 74 72 20 77 69 6e 64 |( Window|Ptr wind|
|000022e0| 6f 77 20 29 3b 0d 09 42 | 6f 6f 6c 65 61 6e 20 49 |ow );..B|oolean I|
|000022f0| 73 44 41 57 69 6e 64 6f | 77 28 20 57 69 6e 64 6f |sDAWindo|w( Windo|
|00002300| 77 50 74 72 20 77 69 6e | 64 6f 77 20 29 3b 0d 09 |wPtr win|dow );..|
|00002310| 42 6f 6f 6c 65 61 6e 20 | 54 72 61 70 41 76 61 69 |Boolean |TrapAvai|
|00002320| 6c 61 62 6c 65 28 20 73 | 68 6f 72 74 20 74 4e 75 |lable( s|hort tNu|
|00002330| 6d 62 65 72 2c 20 54 72 | 61 70 54 79 70 65 20 74 |mber, Tr|apType t|
|00002340| 54 79 70 65 20 29 3b 0d | 23 65 6e 64 69 66 0d 0d |Type );.|#endif..|
|00002350| 0d 2f 2a 20 4d 61 6b 65 | 20 74 68 65 20 32 2e 30 |./* Make| the 2.0|
|00002360| 20 49 6e 74 65 72 66 61 | 63 65 20 66 6f 72 20 70 | Interfa|ce for p|
|00002370| 61 73 73 69 6e 67 20 50 | 6f 69 6e 74 73 20 74 6f |assing P|oints to|
|00002380| 20 74 68 65 20 54 6f 6f | 6c 62 6f 78 20 62 79 20 | the Too|lbox by |
|00002390| 61 64 64 72 65 73 73 2c | 0d 20 20 20 65 6d 75 6c |address,|. emul|
|000023a0| 61 74 65 20 74 68 65 20 | 33 2e 30 20 6d 65 74 68 |ate the |3.0 meth|
|000023b0| 6f 64 20 6f 66 20 70 61 | 73 73 69 6e 67 20 50 6f |od of pa|ssing Po|
|000023c0| 69 6e 74 73 20 62 79 20 | 76 61 6c 75 65 2e 20 54 |ints by |value. T|
|000023d0| 68 69 73 20 6c 69 73 74 | 20 6f 6e 6c 79 20 63 6f |his list| only co|
|000023e0| 6e 74 61 69 6e 73 0d 20 | 20 20 74 68 65 20 61 66 |ntains. | the af|
|000023f0| 66 65 63 74 65 64 20 72 | 6f 75 74 69 6e 65 73 20 |fected r|outines |
|00002400| 61 63 74 75 61 6c 6c 79 | 20 75 73 65 64 20 69 6e |actually| used in|
|00002410| 20 74 68 69 73 20 73 61 | 6d 70 6c 65 2c 20 61 6e | this sa|mple, an|
|00002420| 64 20 69 73 20 6e 6f 74 | 20 69 6e 74 65 6e 64 65 |d is not| intende|
|00002430| 64 20 74 6f 0d 20 20 20 | 62 65 20 61 20 63 6f 6d |d to. |be a com|
|00002440| 70 72 65 68 65 6e 73 69 | 76 65 20 6c 69 73 74 20 |prehensi|ve list |
|00002450| 6f 66 20 74 68 65 20 61 | 66 66 65 63 74 65 64 20 |of the a|ffected |
|00002460| 72 6f 75 74 69 6e 65 73 | 2e 0d 0d 20 20 20 46 6f |routines|... Fo|
|00002470| 72 20 72 6f 75 74 69 6e | 65 73 20 74 68 61 74 20 |r routin|es that |
|00002480| 68 61 76 65 20 53 74 72 | 32 35 35 20 66 6f 72 6d |have Str|255 form|
|00002490| 61 6c 20 70 61 72 61 6d | 65 74 65 72 73 20 77 65 |al param|eters we|
|000024a0| 20 63 61 6e 6e 6f 74 20 | 64 6f 20 61 20 73 69 6d | cannot |do a sim|
|000024b0| 69 6c 61 72 20 74 72 69 | 63 6b 0d 20 20 20 73 6f |ilar tri|ck. so|
|000024c0| 20 74 68 65 20 6e 65 63 | 65 73 73 61 72 79 20 63 | the nec|essary c|
|000024d0| 68 61 6e 67 65 73 20 61 | 72 65 20 69 6e 20 74 68 |hanges a|re in th|
|000024e0| 65 20 63 6f 64 65 20 69 | 74 73 65 6c 66 2e 20 53 |e code i|tself. S|
|000024f0| 65 61 72 63 68 69 6e 67 | 20 66 6f 72 20 4d 50 57 |earching| for MPW|
|00002500| 33 20 77 69 6c 6c 20 66 | 69 6e 64 0d 20 20 20 74 |3 will f|ind. t|
|00002510| 68 65 6d 2e 20 2a 2f 0d | 23 69 66 6e 64 65 66 20 |hem. */.|#ifndef |
|00002520| 4d 50 57 33 0d 23 09 64 | 65 66 69 6e 65 20 46 69 |MPW3.#.d|efine Fi|
|00002530| 6e 64 57 69 6e 64 6f 77 | 09 46 49 4e 44 57 49 4e |ndWindow|.FINDWIN|
|00002540| 44 4f 57 0d 23 09 64 65 | 66 69 6e 65 20 4d 65 6e |DOW.#.de|fine Men|
|00002550| 75 53 65 6c 65 63 74 09 | 4d 45 4e 55 53 45 4c 45 |uSelect.|MENUSELE|
|00002560| 43 54 0d 23 09 64 65 66 | 69 6e 65 20 44 72 61 67 |CT.#.def|ine Drag|
|00002570| 57 69 6e 64 6f 77 09 44 | 52 41 47 57 49 4e 44 4f |Window.D|RAGWINDO|
|00002580| 57 0d 23 09 64 65 66 69 | 6e 65 20 54 72 61 63 6b |W.#.defi|ne Track|
|00002590| 47 6f 41 77 61 79 09 54 | 52 41 43 4b 47 4f 41 57 |GoAway.T|RACKGOAW|
|000025a0| 41 59 0d 23 09 64 65 66 | 69 6e 65 20 50 74 49 6e |AY.#.def|ine PtIn|
|000025b0| 52 67 6e 09 09 50 54 49 | 4e 52 47 4e 0d 23 09 64 |Rgn..PTI|NRGN.#.d|
|000025c0| 65 66 69 6e 65 20 50 74 | 49 6e 52 65 63 74 09 09 |efine Pt|InRect..|
|000025d0| 50 54 49 4e 52 45 43 54 | 0d 23 09 64 65 66 69 6e |PTINRECT|.#.defin|
|000025e0| 65 20 54 45 43 6c 69 63 | 6b 09 09 54 45 43 4c 49 |e TEClic|k..TECLI|
|000025f0| 43 4b 0d 23 09 64 65 66 | 69 6e 65 20 46 69 6e 64 |CK.#.def|ine Find|
|00002600| 43 6f 6e 74 72 6f 6c 09 | 46 49 4e 44 43 4f 4e 54 |Control.|FINDCONT|
|00002610| 52 4f 4c 0d 23 09 64 65 | 66 69 6e 65 20 54 72 61 |ROL.#.de|fine Tra|
|00002620| 63 6b 43 6f 6e 74 72 6f | 6c 09 54 52 41 43 4b 43 |ckContro|l.TRACKC|
|00002630| 4f 4e 54 52 4f 4c 0d 23 | 09 64 65 66 69 6e 65 20 |ONTROL.#|.define |
|00002640| 47 72 6f 77 57 69 6e 64 | 6f 77 09 47 52 4f 57 57 |GrowWind|ow.GROWW|
|00002650| 49 4e 44 4f 57 0d 23 09 | 64 65 66 69 6e 65 20 54 |INDOW.#.|define T|
|00002660| 72 61 63 6b 42 6f 78 09 | 09 54 52 41 43 4b 42 4f |rackBox.|.TRACKBO|
|00002670| 58 0d 23 09 64 65 66 69 | 6e 65 20 44 49 42 61 64 |X.#.defi|ne DIBad|
|00002680| 4d 6f 75 6e 74 09 44 49 | 42 41 44 4d 4f 55 4e 54 |Mount.DI|BADMOUNT|
|00002690| 0d 70 61 73 63 61 6c 20 | 76 6f 69 64 20 44 65 62 |.pascal |void Deb|
|000026a0| 75 67 67 65 72 28 29 0d | 20 20 20 20 65 78 74 65 |ugger().| exte|
|000026b0| 72 6e 20 30 78 41 39 46 | 46 3b 0d 20 2f 2a 20 74 |rn 0xA9F|F;. /* t|
|000026c0| 68 65 20 4d 50 57 20 32 | 2e 30 2e 32 20 43 49 6e |he MPW 2|.0.2 CIn|
|000026d0| 74 65 72 66 61 63 65 73 | 2e 6f 20 63 6f 6e 74 61 |terfaces|.o conta|
|000026e0| 69 6e 73 20 62 6f 67 75 | 73 20 67 6c 75 65 20 66 |ins bogu|s glue f|
|000026f0| 6f 72 20 50 75 72 67 65 | 53 70 61 63 65 2c 20 73 |or Purge|Space, s|
|00002700| 6f 20 77 65 20 69 6e 6c | 69 6e 65 20 2a 2f 0d 23 |o we inl|ine */.#|
|00002710| 09 64 65 66 69 6e 65 20 | 50 75 72 67 65 53 70 61 |.define |PurgeSpa|
|00002720| 63 65 09 52 65 61 6c 50 | 75 72 67 65 53 70 61 63 |ce.RealP|urgeSpac|
|00002730| 65 0d 70 61 73 63 61 6c | 20 76 6f 69 64 20 50 53 |e.pascal| void PS|
|00002740| 31 28 29 20 65 78 74 65 | 72 6e 20 30 78 41 31 36 |1() exte|rn 0xA16|
|00002750| 32 3b 0d 70 61 73 63 61 | 6c 20 76 6f 69 64 20 50 |2;.pasca|l void P|
|00002760| 53 32 28 29 20 65 78 74 | 65 72 6e 20 30 78 32 32 |S2() ext|ern 0x22|
|00002770| 36 46 3b 0d 70 61 73 63 | 61 6c 20 76 6f 69 64 20 |6F;.pasc|al void |
|00002780| 50 53 33 28 29 20 65 78 | 74 65 72 6e 20 30 78 30 |PS3() ex|tern 0x0|
|00002790| 30 30 34 3b 0d 70 61 73 | 63 61 6c 20 76 6f 69 64 |004;.pas|cal void|
|000027a0| 20 50 53 34 28 29 20 65 | 78 74 65 72 6e 20 30 78 | PS4() e|xtern 0x|
|000027b0| 32 32 38 38 3b 0d 70 61 | 73 63 61 6c 20 76 6f 69 |2288;.pa|scal voi|
|000027c0| 64 20 50 53 35 28 29 20 | 65 78 74 65 72 6e 20 30 |d PS5() |extern 0|
|000027d0| 78 32 32 36 46 3b 0d 70 | 61 73 63 61 6c 20 76 6f |x226F;.p|ascal vo|
|000027e0| 69 64 20 50 53 36 28 29 | 20 65 78 74 65 72 6e 20 |id PS6()| extern |
|000027f0| 30 78 30 30 30 38 3b 0d | 70 61 73 63 61 6c 20 76 |0x0008;.|pascal v|
|00002800| 6f 69 64 20 50 53 37 28 | 29 20 65 78 74 65 72 6e |oid PS7(|) extern|
|00002810| 20 30 78 32 32 38 30 3b | 0d 70 61 73 63 61 6c 20 | 0x2280;|.pascal |
|00002820| 76 6f 69 64 20 52 65 61 | 6c 50 75 72 67 65 53 70 |void Rea|lPurgeSp|
|00002830| 61 63 65 20 28 6c 6f 6e | 67 20 2a 74 6f 74 61 6c |ace (lon|g *total|
|00002840| 2c 6c 6f 6e 67 20 2a 63 | 6f 6e 74 69 67 29 0d 09 |,long *c|ontig)..|
|00002850| 7b 20 50 53 31 28 29 3b | 20 50 53 32 28 29 3b 20 |{ PS1();| PS2(); |
|00002860| 50 53 33 28 29 3b 20 50 | 53 34 28 29 3b 20 50 53 |PS3(); P|S4(); PS|
|00002870| 35 28 29 3b 20 50 53 36 | 28 29 3b 20 50 53 37 28 |5(); PS6|(); PS7(|
|00002880| 29 3b 20 7d 0d 09 2f 2a | 09 5f 50 75 72 67 65 53 |); }../*|._PurgeS|
|00002890| 70 61 63 65 0d 09 09 4d | 4f 56 45 2e 4c 09 24 30 |pace...M|OVE.L.$0|
|000028a0| 30 30 34 28 41 37 29 2c | 41 31 0d 09 09 4d 4f 56 |004(A7),|A1...MOV|
|000028b0| 45 2e 4c 09 41 30 2c 28 | 41 31 29 0d 09 09 4d 4f |E.L.A0,(|A1)...MO|
|000028c0| 56 45 2e 4c 09 24 30 30 | 30 38 28 41 37 29 2c 41 |VE.L.$00|08(A7),A|
|000028d0| 31 0d 09 09 4d 4f 56 45 | 2e 4c 09 44 30 2c 28 41 |1...MOVE|.L.D0,(A|
|000028e0| 31 29 0d 09 2a 2f 0d 23 | 65 6e 64 69 66 0d 0d 2f |1)..*/.#|endif../|
|000028f0| 2a 20 44 65 66 69 6e 65 | 20 48 69 57 72 64 20 61 |* Define| HiWrd a|
|00002900| 6e 64 20 4c 6f 57 72 64 | 20 6d 61 63 72 6f 73 20 |nd LoWrd| macros |
|00002910| 66 6f 72 20 65 66 66 69 | 63 69 65 6e 63 79 2e 20 |for effi|ciency. |
|00002920| 2a 2f 0d 23 64 65 66 69 | 6e 65 20 48 69 57 72 64 |*/.#defi|ne HiWrd|
|00002930| 28 61 4c 6f 6e 67 29 09 | 28 28 28 61 4c 6f 6e 67 |(aLong).|(((aLong|
|00002940| 29 20 3e 3e 20 31 36 29 | 20 26 20 30 78 46 46 46 |) >> 16)| & 0xFFF|
|00002950| 46 29 0d 23 64 65 66 69 | 6e 65 20 4c 6f 57 72 64 |F).#defi|ne LoWrd|
|00002960| 28 61 4c 6f 6e 67 29 09 | 28 28 61 4c 6f 6e 67 29 |(aLong).|((aLong)|
|00002970| 20 26 20 30 78 46 46 46 | 46 29 0d 0d 2f 2a 20 44 | & 0xFFF|F)../* D|
|00002980| 65 66 69 6e 65 20 54 6f | 70 4c 65 66 74 20 61 6e |efine To|pLeft an|
|00002990| 64 20 42 6f 74 52 69 67 | 68 74 20 6d 61 63 72 6f |d BotRig|ht macro|
|000029a0| 73 20 66 6f 72 20 63 6f | 6e 76 65 6e 69 65 6e 63 |s for co|nvenienc|
|000029b0| 65 2e 20 4e 6f 74 69 63 | 65 20 74 68 65 20 69 6d |e. Notic|e the im|
|000029c0| 70 6c 69 63 69 74 0d 20 | 20 20 64 65 70 65 6e 64 |plicit. | depend|
|000029d0| 65 6e 63 79 20 6f 6e 20 | 74 68 65 20 6f 72 64 65 |ency on |the orde|
|000029e0| 72 69 6e 67 20 6f 66 20 | 66 69 65 6c 64 73 20 77 |ring of |fields w|
|000029f0| 69 74 68 69 6e 20 61 20 | 52 65 63 74 20 2a 2f 0d |ithin a |Rect */.|
|00002a00| 23 64 65 66 69 6e 65 20 | 54 6f 70 4c 65 66 74 28 |#define |TopLeft(|
|00002a10| 61 52 65 63 74 29 09 28 | 2a 20 28 50 6f 69 6e 74 |aRect).(|* (Point|
|00002a20| 20 2a 29 20 26 28 61 52 | 65 63 74 29 2e 74 6f 70 | *) &(aR|ect).top|
|00002a30| 29 0d 23 64 65 66 69 6e | 65 20 42 6f 74 52 69 67 |).#defin|e BotRig|
|00002a40| 68 74 28 61 52 65 63 74 | 29 09 28 2a 20 28 50 6f |ht(aRect|).(* (Po|
|00002a50| 69 6e 74 20 2a 29 20 26 | 28 61 52 65 63 74 29 2e |int *) &|(aRect).|
|00002a60| 62 6f 74 74 6f 6d 29 0d | 0d 0d 2f 2a 20 54 68 69 |bottom).|../* Thi|
|00002a70| 73 20 72 6f 75 74 69 6e | 65 20 69 73 20 70 61 72 |s routin|e is par|
|00002a80| 74 20 6f 66 20 74 68 65 | 20 4d 50 57 20 72 75 6e |t of the| MPW run|
|00002a90| 74 69 6d 65 20 6c 69 62 | 72 61 72 79 2e 20 54 68 |time lib|rary. Th|
|00002aa0| 69 73 20 65 78 74 65 72 | 6e 61 6c 0d 20 20 20 72 |is exter|nal. r|
|00002ab0| 65 66 65 72 65 6e 63 65 | 20 74 6f 20 69 74 20 69 |eference| to it i|
|00002ac0| 73 20 64 6f 6e 65 20 73 | 6f 20 74 68 61 74 20 77 |s done s|o that w|
|00002ad0| 65 20 63 61 6e 20 75 6e | 6c 6f 61 64 20 69 74 73 |e can un|load its|
|00002ae0| 20 73 65 67 6d 65 6e 74 | 2c 20 25 41 35 49 6e 69 | segment|, %A5Ini|
|00002af0| 74 2e 20 2a 2f 0d 0d 65 | 78 74 65 72 6e 20 76 6f |t. */..e|xtern vo|
|00002b00| 69 64 20 5f 44 61 74 61 | 49 6e 69 74 28 29 3b 0d |id _Data|Init();.|
|00002b10| 0d 0d 2f 2a 20 41 20 72 | 65 66 65 72 65 6e 63 65 |../* A r|eference|
|00002b20| 20 74 6f 20 6f 75 72 20 | 61 73 73 65 6d 62 6c 79 | to our |assembly|
|00002b30| 20 6c 61 6e 67 75 61 67 | 65 20 72 6f 75 74 69 6e | languag|e routin|
|00002b40| 65 20 74 68 61 74 20 67 | 65 74 73 20 61 74 74 61 |e that g|ets atta|
|00002b50| 63 68 65 64 20 74 6f 20 | 74 68 65 20 63 6c 69 6b |ched to |the clik|
|00002b60| 4c 6f 6f 70 0d 66 69 65 | 6c 64 20 6f 66 20 6f 75 |Loop.fie|ld of ou|
|00002b70| 72 20 54 45 20 72 65 63 | 6f 72 64 2e 20 2a 2f 0d |r TE rec|ord. */.|
|00002b80| 0d 65 78 74 65 72 6e 20 | 70 61 73 63 61 6c 20 76 |.extern |pascal v|
|00002b90| 6f 69 64 20 41 73 6d 43 | 6c 69 6b 4c 6f 6f 70 28 |oid AsmC|likLoop(|
|00002ba0| 29 3b 0d 0d 0d 23 64 65 | 66 69 6e 65 20 5f 5f 53 |);...#de|fine __S|
|00002bb0| 45 47 5f 5f 20 4d 61 69 | 6e 0d 6d 61 69 6e 28 29 |EG__ Mai|n.main()|
|00002bc0| 0d 7b 0d 09 55 6e 6c 6f | 61 64 53 65 67 28 28 50 |.{..Unlo|adSeg((P|
|00002bd0| 74 72 29 20 5f 44 61 74 | 61 49 6e 69 74 29 3b 09 |tr) _Dat|aInit);.|
|00002be0| 09 2f 2a 20 6e 6f 74 65 | 20 74 68 61 74 20 5f 44 |./* note| that _D|
|00002bf0| 61 74 61 49 6e 69 74 20 | 6d 75 73 74 20 6e 6f 74 |ataInit |must not|
|00002c00| 20 62 65 20 69 6e 20 4d | 61 69 6e 21 20 2a 2f 0d | be in M|ain! */.|
|00002c10| 09 0d 09 2f 2a 20 31 2e | 30 31 20 2d 20 63 61 6c |.../* 1.|01 - cal|
|00002c20| 6c 20 74 6f 20 46 6f 72 | 63 65 45 6e 76 69 72 6f |l to For|ceEnviro|
|00002c30| 6e 73 20 72 65 6d 6f 76 | 65 64 20 2a 2f 0d 09 0d |ns remov|ed */...|
|00002c40| 09 2f 2a 09 49 66 20 79 | 6f 75 20 68 61 76 65 20 |./*.If y|ou have |
|00002c50| 73 74 61 63 6b 20 72 65 | 71 75 69 72 65 6d 65 6e |stack re|quiremen|
|00002c60| 74 73 20 74 68 61 74 20 | 64 69 66 66 65 72 20 66 |ts that |differ f|
|00002c70| 72 6f 6d 20 74 68 65 20 | 64 65 66 61 75 6c 74 2c |rom the |default,|
|00002c80| 0d 09 09 74 68 65 6e 20 | 79 6f 75 20 63 6f 75 6c |...then |you coul|
|00002c90| 64 20 75 73 65 20 53 65 | 74 41 70 70 6c 4c 69 6d |d use Se|tApplLim|
|00002ca0| 69 74 20 74 6f 20 69 6e | 63 72 65 61 73 65 20 53 |it to in|crease S|
|00002cb0| 74 61 63 6b 53 70 61 63 | 65 20 61 74 20 0d 09 09 |tackSpac|e at ...|
|00002cc0| 74 68 69 73 20 70 6f 69 | 6e 74 2c 20 62 65 66 6f |this poi|nt, befo|
|00002cd0| 72 65 20 63 61 6c 6c 69 | 6e 67 20 4d 61 78 41 70 |re calli|ng MaxAp|
|00002ce0| 70 6c 5a 6f 6e 65 2e 20 | 2a 2f 0d 09 4d 61 78 41 |plZone. |*/..MaxA|
|00002cf0| 70 70 6c 5a 6f 6e 65 28 | 29 3b 09 09 09 09 09 2f |pplZone(|);...../|
|00002d00| 2a 20 65 78 70 61 6e 64 | 20 74 68 65 20 68 65 61 |* expand| the hea|
|00002d10| 70 20 73 6f 20 63 6f 64 | 65 20 73 65 67 6d 65 6e |p so cod|e segmen|
|00002d20| 74 73 20 6c 6f 61 64 20 | 61 74 20 74 68 65 20 74 |ts load |at the t|
|00002d30| 6f 70 20 2a 2f 0d 0d 09 | 49 6e 69 74 69 61 6c 69 |op */...|Initiali|
|00002d40| 7a 65 28 29 3b 09 09 09 | 09 09 2f 2a 20 69 6e 69 |ze();...|../* ini|
|00002d50| 74 69 61 6c 69 7a 65 20 | 74 68 65 20 70 72 6f 67 |tialize |the prog|
|00002d60| 72 61 6d 20 2a 2f 0d 09 | 55 6e 6c 6f 61 64 53 65 |ram */..|UnloadSe|
|00002d70| 67 28 28 50 74 72 29 20 | 49 6e 69 74 69 61 6c 69 |g((Ptr) |Initiali|
|00002d80| 7a 65 29 3b 09 2f 2a 20 | 6e 6f 74 65 20 74 68 61 |ze);./* |note tha|
|00002d90| 74 20 49 6e 69 74 69 61 | 6c 69 7a 65 20 6d 75 73 |t Initia|lize mus|
|00002da0| 74 20 6e 6f 74 20 62 65 | 20 69 6e 20 4d 61 69 6e |t not be| in Main|
|00002db0| 21 20 2a 2f 0d 0d 09 45 | 76 65 6e 74 4c 6f 6f 70 |! */...E|ventLoop|
|00002dc0| 28 29 3b 09 09 09 09 09 | 2f 2a 20 63 61 6c 6c 20 |();.....|/* call |
|00002dd0| 74 68 65 20 6d 61 69 6e | 20 65 76 65 6e 74 20 6c |the main| event l|
|00002de0| 6f 6f 70 20 2a 2f 0d 7d | 0d 0d 0d 2f 2a 20 47 65 |oop */.}|.../* Ge|
|00002df0| 74 20 65 76 65 6e 74 73 | 20 66 6f 72 65 76 65 72 |t events| forever|
|00002e00| 2c 20 61 6e 64 20 68 61 | 6e 64 6c 65 20 74 68 65 |, and ha|ndle the|
|00002e10| 6d 20 62 79 20 63 61 6c | 6c 69 6e 67 20 44 6f 45 |m by cal|ling DoE|
|00002e20| 76 65 6e 74 2e 0d 20 20 | 20 41 6c 73 6f 20 63 61 |vent.. | Also ca|
|00002e30| 6c 6c 20 41 64 6a 75 73 | 74 43 75 72 73 6f 72 20 |ll Adjus|tCursor |
|00002e40| 65 61 63 68 20 74 69 6d | 65 20 74 68 72 6f 75 67 |each tim|e throug|
|00002e50| 68 20 74 68 65 20 6c 6f | 6f 70 2e 20 2a 2f 0d 0d |h the lo|op. */..|
|00002e60| 23 64 65 66 69 6e 65 20 | 5f 5f 53 45 47 5f 5f 20 |#define |__SEG__ |
|00002e70| 4d 61 69 6e 0d 76 6f 69 | 64 20 45 76 65 6e 74 4c |Main.voi|d EventL|
|00002e80| 6f 6f 70 28 29 0d 7b 0d | 09 52 67 6e 48 61 6e 64 |oop().{.|.RgnHand|
|00002e90| 6c 65 09 63 75 72 73 6f | 72 52 67 6e 3b 0d 09 42 |le.curso|rRgn;..B|
|00002ea0| 6f 6f 6c 65 61 6e 09 09 | 67 6f 74 45 76 65 6e 74 |oolean..|gotEvent|
|00002eb0| 3b 0d 09 45 76 65 6e 74 | 52 65 63 6f 72 64 09 65 |;..Event|Record.e|
|00002ec0| 76 65 6e 74 3b 0d 0d 09 | 63 75 72 73 6f 72 52 67 |vent;...|cursorRg|
|00002ed0| 6e 20 3d 20 4e 65 77 52 | 67 6e 28 29 3b 09 09 09 |n = NewR|gn();...|
|00002ee0| 2f 2a 20 77 65 d5 6c 6c | 20 70 61 73 73 20 57 4e |/* we.ll| pass WN|
|00002ef0| 45 20 61 6e 20 65 6d 70 | 74 79 20 72 65 67 69 6f |E an emp|ty regio|
|00002f00| 6e 20 74 68 65 20 31 73 | 74 20 74 69 6d 65 20 74 |n the 1s|t time t|
|00002f10| 68 72 75 20 2a 2f 0d 09 | 64 6f 20 7b 0d 09 09 2f |hru */..|do {.../|
|00002f20| 2a 20 75 73 65 20 57 4e | 45 20 69 66 20 69 74 20 |* use WN|E if it |
|00002f30| 69 73 20 61 76 61 69 6c | 61 62 6c 65 20 2a 2f 0d |is avail|able */.|
|00002f40| 09 09 69 66 20 28 20 67 | 48 61 73 57 61 69 74 4e |..if ( g|HasWaitN|
|00002f50| 65 78 74 45 76 65 6e 74 | 20 29 0d 09 09 09 67 6f |extEvent| )....go|
|00002f60| 74 45 76 65 6e 74 20 3d | 20 57 61 69 74 4e 65 78 |tEvent =| WaitNex|
|00002f70| 74 45 76 65 6e 74 28 65 | 76 65 72 79 45 76 65 6e |tEvent(e|veryEven|
|00002f80| 74 2c 20 26 65 76 65 6e | 74 2c 20 47 65 74 53 6c |t, &even|t, GetSl|
|00002f90| 65 65 70 28 29 2c 20 63 | 75 72 73 6f 72 52 67 6e |eep(), c|ursorRgn|
|00002fa0| 29 3b 0d 09 09 65 6c 73 | 65 20 7b 0d 09 09 09 53 |);...els|e {....S|
|00002fb0| 79 73 74 65 6d 54 61 73 | 6b 28 29 3b 0d 09 09 09 |ystemTas|k();....|
|00002fc0| 67 6f 74 45 76 65 6e 74 | 20 3d 20 47 65 74 4e 65 |gotEvent| = GetNe|
|00002fd0| 78 74 45 76 65 6e 74 28 | 65 76 65 72 79 45 76 65 |xtEvent(|everyEve|
|00002fe0| 6e 74 2c 20 26 65 76 65 | 6e 74 29 3b 0d 09 09 7d |nt, &eve|nt);...}|
|00002ff0| 0d 09 09 69 66 20 28 20 | 67 6f 74 45 76 65 6e 74 |...if ( |gotEvent|
|00003000| 20 29 20 7b 0d 09 09 09 | 2f 2a 20 6d 61 6b 65 20 | ) {....|/* make |
|00003010| 73 75 72 65 20 77 65 20 | 68 61 76 65 20 74 68 65 |sure we |have the|
|00003020| 20 72 69 67 68 74 20 63 | 75 72 73 6f 72 20 62 65 | right c|ursor be|
|00003030| 66 6f 72 65 20 68 61 6e | 64 6c 69 6e 67 20 74 68 |fore han|dling th|
|00003040| 65 20 65 76 65 6e 74 20 | 2a 2f 0d 09 09 09 41 64 |e event |*/....Ad|
|00003050| 6a 75 73 74 43 75 72 73 | 6f 72 28 65 76 65 6e 74 |justCurs|or(event|
|00003060| 2e 77 68 65 72 65 2c 20 | 63 75 72 73 6f 72 52 67 |.where, |cursorRg|
|00003070| 6e 29 3b 0d 09 09 09 44 | 6f 45 76 65 6e 74 28 26 |n);....D|oEvent(&|
|00003080| 65 76 65 6e 74 29 3b 0d | 09 09 7d 0d 09 09 65 6c |event);.|..}...el|
|00003090| 73 65 0d 09 09 09 44 6f | 49 64 6c 65 28 29 3b 09 |se....Do|Idle();.|
|000030a0| 09 09 09 2f 2a 20 70 65 | 72 66 6f 72 6d 20 69 64 |.../* pe|rform id|
|000030b0| 6c 65 20 74 61 73 6b 73 | 20 77 68 65 6e 20 69 74 |le tasks| when it|
|000030c0| d5 73 20 6e 6f 74 20 6f | 75 72 20 65 76 65 6e 74 |.s not o|ur event|
|000030d0| 20 2a 2f 0d 09 09 2f 2a | 20 63 68 61 6e 67 65 20 | */.../*| change |
|000030e0| 74 68 65 20 63 75 72 73 | 6f 72 20 28 61 6e 64 20 |the curs|or (and |
|000030f0| 72 65 67 69 6f 6e 29 20 | 69 66 20 6e 65 63 65 73 |region) |if neces|
|00003100| 73 61 72 79 20 2a 2f 0d | 09 09 41 64 6a 75 73 74 |sary */.|..Adjust|
|00003110| 43 75 72 73 6f 72 28 65 | 76 65 6e 74 2e 77 68 65 |Cursor(e|vent.whe|
|00003120| 72 65 2c 20 63 75 72 73 | 6f 72 52 67 6e 29 3b 0d |re, curs|orRgn);.|
|00003130| 09 7d 20 77 68 69 6c 65 | 20 28 20 74 72 75 65 20 |.} while| ( true |
|00003140| 29 3b 09 2f 2a 20 6c 6f | 6f 70 20 66 6f 72 65 76 |);./* lo|op forev|
|00003150| 65 72 3b 20 77 65 20 71 | 75 69 74 20 76 69 61 20 |er; we q|uit via |
|00003160| 45 78 69 74 54 6f 53 68 | 65 6c 6c 20 2a 2f 0d 7d |ExitToSh|ell */.}|
|00003170| 20 2f 2a 45 76 65 6e 74 | 4c 6f 6f 70 2a 2f 0d 0d | /*Event|Loop*/..|
|00003180| 0d 2f 2a 20 44 6f 20 74 | 68 65 20 72 69 67 68 74 |./* Do t|he right|
|00003190| 20 74 68 69 6e 67 20 66 | 6f 72 20 61 6e 20 65 76 | thing f|or an ev|
|000031a0| 65 6e 74 2e 20 44 65 74 | 65 72 6d 69 6e 65 20 77 |ent. Det|ermine w|
|000031b0| 68 61 74 20 6b 69 6e 64 | 20 6f 66 20 65 76 65 6e |hat kind| of even|
|000031c0| 74 20 69 74 20 69 73 2c | 20 61 6e 64 20 63 61 6c |t it is,| and cal|
|000031d0| 6c 0d 20 74 68 65 20 61 | 70 70 72 6f 70 72 69 61 |l. the a|ppropria|
|000031e0| 74 65 20 72 6f 75 74 69 | 6e 65 73 2e 20 2a 2f 0d |te routi|nes. */.|
|000031f0| 0d 23 64 65 66 69 6e 65 | 20 5f 5f 53 45 47 5f 5f |.#define| __SEG__|
|00003200| 20 4d 61 69 6e 0d 76 6f | 69 64 20 44 6f 45 76 65 | Main.vo|id DoEve|
|00003210| 6e 74 28 65 76 65 6e 74 | 29 0d 09 45 76 65 6e 74 |nt(event|)..Event|
|00003220| 52 65 63 6f 72 64 09 2a | 65 76 65 6e 74 3b 0d 7b |Record.*|event;.{|
|00003230| 0d 09 73 68 6f 72 74 09 | 09 70 61 72 74 2c 20 65 |..short.|.part, e|
|00003240| 72 72 3b 0d 09 57 69 6e | 64 6f 77 50 74 72 09 77 |rr;..Win|dowPtr.w|
|00003250| 69 6e 64 6f 77 3b 0d 09 | 63 68 61 72 09 09 6b 65 |indow;..|char..ke|
|00003260| 79 3b 0d 09 50 6f 69 6e | 74 09 09 61 50 6f 69 6e |y;..Poin|t..aPoin|
|00003270| 74 3b 0d 0d 09 73 77 69 | 74 63 68 20 28 20 65 76 |t;...swi|tch ( ev|
|00003280| 65 6e 74 2d 3e 77 68 61 | 74 20 29 20 7b 0d 09 09 |ent->wha|t ) {...|
|00003290| 63 61 73 65 20 6e 75 6c | 6c 45 76 65 6e 74 3a 0d |case nul|lEvent:.|
|000032a0| 09 09 09 2f 2a 20 77 65 | 20 69 64 6c 65 20 66 6f |.../* we| idle fo|
|000032b0| 72 20 6e 75 6c 6c 2f 6d | 6f 75 73 65 20 6d 6f 76 |r null/m|ouse mov|
|000032c0| 65 64 20 65 76 65 6e 74 | 73 20 61 6e 64 73 20 66 |ed event|s ands f|
|000032d0| 6f 72 20 65 76 65 6e 74 | 73 20 77 68 69 63 68 20 |or event|s which |
|000032e0| 61 72 65 6e d5 74 0d 09 | 09 09 09 6f 75 72 73 20 |aren.t..|...ours |
|000032f0| 28 73 65 65 20 45 76 65 | 6e 74 4c 6f 6f 70 29 20 |(see Eve|ntLoop) |
|00003300| 2a 2f 0d 09 09 09 44 6f | 49 64 6c 65 28 29 3b 0d |*/....Do|Idle();.|
|00003310| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 63 61 73 65 |...break|;...case|
|00003320| 20 6d 6f 75 73 65 44 6f | 77 6e 3a 0d 09 09 09 70 | mouseDo|wn:....p|
|00003330| 61 72 74 20 3d 20 46 69 | 6e 64 57 69 6e 64 6f 77 |art = Fi|ndWindow|
|00003340| 28 65 76 65 6e 74 2d 3e | 77 68 65 72 65 2c 20 26 |(event->|where, &|
|00003350| 77 69 6e 64 6f 77 29 3b | 0d 09 09 09 73 77 69 74 |window);|....swit|
|00003360| 63 68 20 28 20 70 61 72 | 74 20 29 20 7b 0d 09 09 |ch ( par|t ) {...|
|00003370| 09 09 63 61 73 65 20 69 | 6e 4d 65 6e 75 42 61 72 |..case i|nMenuBar|
|00003380| 3a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 2f 2a |: | /*|
|00003390| 20 70 72 6f 63 65 73 73 | 20 61 20 6d 6f 75 73 65 | process| a mouse|
|000033a0| 20 6d 65 6e 75 20 63 6f | 6d 6d 61 6e 64 20 28 69 | menu co|mmand (i|
|000033b0| 66 20 61 6e 79 29 20 2a | 2f 0d 09 09 09 09 09 41 |f any) *|/......A|
|000033c0| 64 6a 75 73 74 4d 65 6e | 75 73 28 29 3b 09 2f 2a |djustMen|us();./*|
|000033d0| 20 62 72 69 6e 67 20 d5 | 65 6d 20 75 70 2d 74 6f | bring .|em up-to|
|000033e0| 2d 64 61 74 65 20 2a 2f | 0d 09 09 09 09 09 44 6f |-date */|......Do|
|000033f0| 4d 65 6e 75 43 6f 6d 6d | 61 6e 64 28 4d 65 6e 75 |MenuComm|and(Menu|
|00003400| 53 65 6c 65 63 74 28 65 | 76 65 6e 74 2d 3e 77 68 |Select(e|vent->wh|
|00003410| 65 72 65 29 29 3b 0d 09 | 09 09 09 09 62 72 65 61 |ere));..|....brea|
|00003420| 6b 3b 0d 09 09 09 09 63 | 61 73 65 20 69 6e 53 79 |k;.....c|ase inSy|
|00003430| 73 57 69 6e 64 6f 77 3a | 20 20 20 20 20 20 20 20 |sWindow:| |
|00003440| 20 20 20 2f 2a 20 6c 65 | 74 20 74 68 65 20 73 79 | /* le|t the sy|
|00003450| 73 74 65 6d 20 68 61 6e | 64 6c 65 20 74 68 65 20 |stem han|dle the |
|00003460| 6d 6f 75 73 65 44 6f 77 | 6e 20 2a 2f 0d 09 09 09 |mouseDow|n */....|
|00003470| 09 09 53 79 73 74 65 6d | 43 6c 69 63 6b 28 65 76 |..System|Click(ev|
|00003480| 65 6e 74 2c 20 77 69 6e | 64 6f 77 29 3b 0d 09 09 |ent, win|dow);...|
|00003490| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 09 63 61 |...break|;.....ca|
|000034a0| 73 65 20 69 6e 43 6f 6e | 74 65 6e 74 3a 0d 09 09 |se inCon|tent:...|
|000034b0| 09 09 09 69 66 20 28 20 | 77 69 6e 64 6f 77 20 21 |...if ( |window !|
|000034c0| 3d 20 46 72 6f 6e 74 57 | 69 6e 64 6f 77 28 29 20 |= FrontW|indow() |
|000034d0| 29 20 7b 0d 09 09 09 09 | 09 09 53 65 6c 65 63 74 |) {.....|..Select|
|000034e0| 57 69 6e 64 6f 77 28 77 | 69 6e 64 6f 77 29 3b 0d |Window(w|indow);.|
|000034f0| 09 09 09 09 09 09 2f 2a | 44 6f 45 76 65 6e 74 28 |....../*|DoEvent(|
|00003500| 65 76 65 6e 74 29 3b 2a | 2f 09 2f 2a 20 75 73 65 |event);*|/./* use|
|00003510| 20 74 68 69 73 20 6c 69 | 6e 65 20 66 6f 72 20 22 | this li|ne for "|
|00003520| 64 6f 20 66 69 72 73 74 | 20 63 6c 69 63 6b 22 20 |do first| click" |
|00003530| 2a 2f 0d 09 09 09 09 09 | 7d 20 65 6c 73 65 0d 09 |*/......|} else..|
|00003540| 09 09 09 09 09 44 6f 43 | 6f 6e 74 65 6e 74 43 6c |.....DoC|ontentCl|
|00003550| 69 63 6b 28 77 69 6e 64 | 6f 77 2c 20 65 76 65 6e |ick(wind|ow, even|
|00003560| 74 29 3b 0d 09 09 09 09 | 09 62 72 65 61 6b 3b 0d |t);.....|.break;.|
|00003570| 09 09 09 09 63 61 73 65 | 20 69 6e 44 72 61 67 3a |....case| inDrag:|
|00003580| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003590| 2f 2a 20 70 61 73 73 20 | 73 63 72 65 65 6e 42 69 |/* pass |screenBi|
|000035a0| 74 73 2e 62 6f 75 6e 64 | 73 20 74 6f 20 67 65 74 |ts.bound|s to get|
|000035b0| 20 61 6c 6c 20 67 44 65 | 76 69 63 65 73 20 2a 2f | all gDe|vices */|
|000035c0| 0d 09 09 09 09 09 44 72 | 61 67 57 69 6e 64 6f 77 |......Dr|agWindow|
|000035d0| 28 77 69 6e 64 6f 77 2c | 20 65 76 65 6e 74 2d 3e |(window,| event->|
|000035e0| 77 68 65 72 65 2c 20 26 | 71 64 2e 73 63 72 65 65 |where, &|qd.scree|
|000035f0| 6e 42 69 74 73 2e 62 6f | 75 6e 64 73 29 3b 0d 09 |nBits.bo|unds);..|
|00003600| 09 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 09 09 63 |....brea|k;.....c|
|00003610| 61 73 65 20 69 6e 47 6f | 41 77 61 79 3a 0d 09 09 |ase inGo|Away:...|
|00003620| 09 09 09 69 66 20 28 20 | 54 72 61 63 6b 47 6f 41 |...if ( |TrackGoA|
|00003630| 77 61 79 28 77 69 6e 64 | 6f 77 2c 20 65 76 65 6e |way(wind|ow, even|
|00003640| 74 2d 3e 77 68 65 72 65 | 29 20 29 0d 09 09 09 09 |t->where|) ).....|
|00003650| 09 09 44 6f 43 6c 6f 73 | 65 57 69 6e 64 6f 77 28 |..DoClos|eWindow(|
|00003660| 77 69 6e 64 6f 77 29 3b | 20 2f 2a 20 77 65 20 64 |window);| /* we d|
|00003670| 6f 6e d5 74 20 63 61 72 | 65 20 69 66 20 74 68 65 |on.t car|e if the|
|00003680| 20 75 73 65 72 20 63 61 | 6e 63 65 6c 6c 65 64 20 | user ca|ncelled |
|00003690| 2a 2f 0d 09 09 09 09 09 | 62 72 65 61 6b 3b 0d 09 |*/......|break;..|
|000036a0| 09 09 09 63 61 73 65 20 | 69 6e 47 72 6f 77 3a 0d |...case |inGrow:.|
|000036b0| 09 09 09 09 09 44 6f 47 | 72 6f 77 57 69 6e 64 6f |.....DoG|rowWindo|
|000036c0| 77 28 77 69 6e 64 6f 77 | 2c 20 65 76 65 6e 74 29 |w(window|, event)|
|000036d0| 3b 0d 09 09 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |;......b|reak;...|
|000036e0| 09 09 63 61 73 65 20 69 | 6e 5a 6f 6f 6d 49 6e 3a |..case i|nZoomIn:|
|000036f0| 0d 09 09 09 09 63 61 73 | 65 20 69 6e 5a 6f 6f 6d |.....cas|e inZoom|
|00003700| 4f 75 74 3a 0d 09 09 09 | 09 69 66 20 28 20 54 72 |Out:....|.if ( Tr|
|00003710| 61 63 6b 42 6f 78 28 77 | 69 6e 64 6f 77 2c 20 65 |ackBox(w|indow, e|
|00003720| 76 65 6e 74 2d 3e 77 68 | 65 72 65 2c 20 70 61 72 |vent->wh|ere, par|
|00003730| 74 29 20 29 0d 09 09 09 | 09 09 09 44 6f 5a 6f 6f |t) )....|...DoZoo|
|00003740| 6d 57 69 6e 64 6f 77 28 | 77 69 6e 64 6f 77 2c 20 |mWindow(|window, |
|00003750| 70 61 72 74 29 3b 0d 09 | 09 09 09 09 62 72 65 61 |part);..|....brea|
|00003760| 6b 3b 0d 09 09 09 7d 0d | 09 09 09 62 72 65 61 6b |k;....}.|...break|
|00003770| 3b 0d 09 09 63 61 73 65 | 20 6b 65 79 44 6f 77 6e |;...case| keyDown|
|00003780| 3a 0d 09 09 63 61 73 65 | 20 61 75 74 6f 4b 65 79 |:...case| autoKey|
|00003790| 3a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |: | |
|000037a0| 20 20 20 20 20 20 20 20 | 2f 2a 20 63 68 65 63 6b | |/* check|
|000037b0| 20 66 6f 72 20 6d 65 6e | 75 6b 65 79 20 65 71 75 | for men|ukey equ|
|000037c0| 69 76 61 6c 65 6e 74 73 | 20 2a 2f 0d 09 09 09 6b |ivalents| */....k|
|000037d0| 65 79 20 3d 20 65 76 65 | 6e 74 2d 3e 6d 65 73 73 |ey = eve|nt->mess|
|000037e0| 61 67 65 20 26 20 63 68 | 61 72 43 6f 64 65 4d 61 |age & ch|arCodeMa|
|000037f0| 73 6b 3b 0d 09 09 09 69 | 66 20 28 20 65 76 65 6e |sk;....i|f ( even|
|00003800| 74 2d 3e 6d 6f 64 69 66 | 69 65 72 73 20 26 20 63 |t->modif|iers & c|
|00003810| 6d 64 4b 65 79 20 29 20 | 7b 09 2f 2a 20 43 6f 6d |mdKey ) |{./* Com|
|00003820| 6d 61 6e 64 20 6b 65 79 | 20 64 6f 77 6e 20 2a 2f |mand key| down */|
|00003830| 0d 09 09 09 09 69 66 20 | 28 20 65 76 65 6e 74 2d |.....if |( event-|
|00003840| 3e 77 68 61 74 20 3d 3d | 20 6b 65 79 44 6f 77 6e |>what ==| keyDown|
|00003850| 20 29 20 7b 0d 09 09 09 | 09 09 41 64 6a 75 73 74 | ) {....|..Adjust|
|00003860| 4d 65 6e 75 73 28 29 3b | 09 09 09 2f 2a 20 65 6e |Menus();|.../* en|
|00003870| 61 62 6c 65 2f 64 69 73 | 61 62 6c 65 2f 63 68 65 |able/dis|able/che|
|00003880| 63 6b 20 6d 65 6e 75 20 | 69 74 65 6d 73 20 70 72 |ck menu |items pr|
|00003890| 6f 70 65 72 6c 79 20 2a | 2f 0d 09 09 09 09 09 44 |operly *|/......D|
|000038a0| 6f 4d 65 6e 75 43 6f 6d | 6d 61 6e 64 28 4d 65 6e |oMenuCom|mand(Men|
|000038b0| 75 4b 65 79 28 6b 65 79 | 29 29 3b 0d 09 09 09 09 |uKey(key|));.....|
|000038c0| 7d 0d 09 09 09 7d 20 65 | 6c 73 65 0d 09 09 09 09 |}....} e|lse.....|
|000038d0| 44 6f 4b 65 79 44 6f 77 | 6e 28 65 76 65 6e 74 29 |DoKeyDow|n(event)|
|000038e0| 3b 0d 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 63 61 |;....bre|ak;...ca|
|000038f0| 73 65 20 61 63 74 69 76 | 61 74 65 45 76 74 3a 0d |se activ|ateEvt:.|
|00003900| 09 09 09 44 6f 41 63 74 | 69 76 61 74 65 28 28 57 |...DoAct|ivate((W|
|00003910| 69 6e 64 6f 77 50 74 72 | 29 20 65 76 65 6e 74 2d |indowPtr|) event-|
|00003920| 3e 6d 65 73 73 61 67 65 | 2c 20 28 65 76 65 6e 74 |>message|, (event|
|00003930| 2d 3e 6d 6f 64 69 66 69 | 65 72 73 20 26 20 61 63 |->modifi|ers & ac|
|00003940| 74 69 76 65 46 6c 61 67 | 29 20 21 3d 20 30 29 3b |tiveFlag|) != 0);|
|00003950| 0d 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 63 61 73 |....brea|k;...cas|
|00003960| 65 20 75 70 64 61 74 65 | 45 76 74 3a 0d 09 09 09 |e update|Evt:....|
|00003970| 44 6f 55 70 64 61 74 65 | 28 28 57 69 6e 64 6f 77 |DoUpdate|((Window|
|00003980| 50 74 72 29 20 65 76 65 | 6e 74 2d 3e 6d 65 73 73 |Ptr) eve|nt->mess|
|00003990| 61 67 65 29 3b 0d 09 09 | 09 62 72 65 61 6b 3b 0d |age);...|.break;.|
|000039a0| 09 09 2f 2a 09 31 2e 30 | 31 20 2d 20 49 74 20 69 |../*.1.0|1 - It i|
|000039b0| 73 20 6e 6f 74 20 61 20 | 62 61 64 20 69 64 65 61 |s not a |bad idea|
|000039c0| 20 74 6f 20 61 74 20 6c | 65 61 73 74 20 63 61 6c | to at l|east cal|
|000039d0| 6c 20 44 49 42 61 64 4d | 6f 75 6e 74 20 69 6e 20 |l DIBadM|ount in |
|000039e0| 72 65 73 70 6f 6e 73 65 | 0d 09 09 09 74 6f 20 61 |response|....to a|
|000039f0| 20 64 69 73 6b 45 76 74 | 2c 20 73 6f 20 74 68 61 | diskEvt|, so tha|
|00003a00| 74 20 74 68 65 20 75 73 | 65 72 20 63 61 6e 20 66 |t the us|er can f|
|00003a10| 6f 72 6d 61 74 20 61 20 | 66 6c 6f 70 70 79 2e 20 |ormat a |floppy. |
|00003a20| 2a 2f 0d 09 09 63 61 73 | 65 20 64 69 73 6b 45 76 |*/...cas|e diskEv|
|00003a30| 74 3a 0d 09 09 09 69 66 | 20 28 20 48 69 57 6f 72 |t:....if| ( HiWor|
|00003a40| 64 28 65 76 65 6e 74 2d | 3e 6d 65 73 73 61 67 65 |d(event-|>message|
|00003a50| 29 20 21 3d 20 6e 6f 45 | 72 72 20 29 20 7b 0d 09 |) != noE|rr ) {..|
|00003a60| 09 09 09 53 65 74 50 74 | 28 26 61 50 6f 69 6e 74 |...SetPt|(&aPoint|
|00003a70| 2c 20 6b 44 49 4c 65 66 | 74 2c 20 6b 44 49 54 6f |, kDILef|t, kDITo|
|00003a80| 70 29 3b 0d 09 09 09 09 | 65 72 72 20 3d 20 44 49 |p);.....|err = DI|
|00003a90| 42 61 64 4d 6f 75 6e 74 | 28 61 50 6f 69 6e 74 2c |BadMount|(aPoint,|
|00003aa0| 20 65 76 65 6e 74 2d 3e | 6d 65 73 73 61 67 65 29 | event->|message)|
|00003ab0| 3b 0d 09 09 09 7d 0d 09 | 09 09 62 72 65 61 6b 3b |;....}..|..break;|
|00003ac0| 0d 09 09 63 61 73 65 20 | 6b 4f 53 45 76 65 6e 74 |...case |kOSEvent|
|00003ad0| 3a 0d 09 09 09 73 77 69 | 74 63 68 20 28 65 76 65 |:....swi|tch (eve|
|00003ae0| 6e 74 2d 3e 6d 65 73 73 | 61 67 65 20 3e 3e 20 32 |nt->mess|age >> 2|
|00003af0| 34 29 20 7b 09 09 2f 2a | 20 68 69 67 68 20 62 79 |4) {../*| high by|
|00003b00| 74 65 20 6f 66 20 6d 65 | 73 73 61 67 65 20 2a 2f |te of me|ssage */|
|00003b10| 0d 09 09 09 09 63 61 73 | 65 20 6b 4d 6f 75 73 65 |.....cas|e kMouse|
|00003b20| 4d 6f 76 65 64 4d 65 73 | 73 61 67 65 3a 0d 09 09 |MovedMes|sage:...|
|00003b30| 09 09 09 44 6f 49 64 6c | 65 28 29 3b 09 09 09 09 |...DoIdl|e();....|
|00003b40| 09 2f 2a 20 6d 6f 75 73 | 65 2d 6d 6f 76 65 64 20 |./* mous|e-moved |
|00003b50| 69 73 20 61 6c 73 6f 20 | 61 6e 20 69 64 6c 65 20 |is also |an idle |
|00003b60| 65 76 65 6e 74 20 2a 2f | 0d 09 09 09 09 09 62 72 |event */|......br|
|00003b70| 65 61 6b 3b 0d 09 09 09 | 09 63 61 73 65 20 6b 53 |eak;....|.case kS|
|00003b80| 75 73 70 65 6e 64 52 65 | 73 75 6d 65 4d 65 73 73 |uspendRe|sumeMess|
|00003b90| 61 67 65 3a 09 09 2f 2a | 20 73 75 73 70 65 6e 64 |age:../*| suspend|
|00003ba0| 2f 72 65 73 75 6d 65 20 | 69 73 20 61 6c 73 6f 20 |/resume |is also |
|00003bb0| 61 6e 20 61 63 74 69 76 | 61 74 65 2f 64 65 61 63 |an activ|ate/deac|
|00003bc0| 74 69 76 61 74 65 20 2a | 2f 0d 09 09 09 09 09 67 |tivate *|/......g|
|00003bd0| 49 6e 42 61 63 6b 67 72 | 6f 75 6e 64 20 3d 20 28 |InBackgr|ound = (|
|00003be0| 65 76 65 6e 74 2d 3e 6d | 65 73 73 61 67 65 20 26 |event->m|essage &|
|00003bf0| 20 6b 52 65 73 75 6d 65 | 4d 61 73 6b 29 20 3d 3d | kResume|Mask) ==|
|00003c00| 20 30 3b 0d 09 09 09 09 | 09 44 6f 41 63 74 69 76 | 0;.....|.DoActiv|
|00003c10| 61 74 65 28 46 72 6f 6e | 74 57 69 6e 64 6f 77 28 |ate(Fron|tWindow(|
|00003c20| 29 2c 20 21 67 49 6e 42 | 61 63 6b 67 72 6f 75 6e |), !gInB|ackgroun|
|00003c30| 64 29 3b 0d 09 09 09 09 | 09 62 72 65 61 6b 3b 0d |d);.....|.break;.|
|00003c40| 09 09 09 7d 0d 09 09 09 | 62 72 65 61 6b 3b 0d 09 |...}....|break;..|
|00003c50| 7d 0d 7d 20 2f 2a 44 6f | 45 76 65 6e 74 2a 2f 0d |}.} /*Do|Event*/.|
|00003c60| 0d 0d 2f 2a 09 43 68 61 | 6e 67 65 20 74 68 65 20 |../*.Cha|nge the |
|00003c70| 63 75 72 73 6f 72 27 73 | 20 73 68 61 70 65 2c 20 |cursor's| shape, |
|00003c80| 64 65 70 65 6e 64 69 6e | 67 20 6f 6e 20 69 74 73 |dependin|g on its|
|00003c90| 20 70 6f 73 69 74 69 6f | 6e 2e 20 54 68 69 73 20 | positio|n. This |
|00003ca0| 61 6c 73 6f 20 63 61 6c | 63 75 6c 61 74 65 73 20 |also cal|culates |
|00003cb0| 74 68 65 20 72 65 67 69 | 6f 6e 0d 09 77 68 65 72 |the regi|on..wher|
|00003cc0| 65 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 63 75 |e the cu|rrent cu|
|00003cd0| 72 73 6f 72 20 72 65 73 | 69 64 65 73 20 28 66 6f |rsor res|ides (fo|
|00003ce0| 72 20 57 61 69 74 4e 65 | 78 74 45 76 65 6e 74 29 |r WaitNe|xtEvent)|
|00003cf0| 2e 20 57 68 65 6e 20 74 | 68 65 20 6d 6f 75 73 65 |. When t|he mouse|
|00003d00| 20 6d 6f 76 65 73 20 6f | 75 74 73 69 64 65 20 6f | moves o|utside o|
|00003d10| 66 0d 09 74 68 69 73 20 | 72 65 67 69 6f 6e 2c 20 |f..this |region, |
|00003d20| 61 6e 20 65 76 65 6e 74 | 20 69 73 20 67 65 6e 65 |an event| is gene|
|00003d30| 72 61 74 65 64 2e 20 49 | 66 20 74 68 65 72 65 20 |rated. I|f there |
|00003d40| 69 73 20 6d 6f 72 65 20 | 74 6f 20 74 68 65 20 65 |is more |to the e|
|00003d50| 76 65 6e 74 20 74 68 61 | 6e 20 6a 75 73 74 0d 09 |vent tha|n just..|
|00003d60| d2 74 68 65 20 6d 6f 75 | 73 65 20 6d 6f 76 65 64 |.the mou|se moved|
|00003d70| d3 2c 20 77 65 20 67 65 | 74 20 63 61 6c 6c 65 64 |., we ge|t called|
|00003d80| 20 62 65 66 6f 72 65 20 | 74 68 65 20 65 76 65 6e | before |the even|
|00003d90| 74 20 69 73 20 70 72 6f | 63 65 73 73 65 64 20 74 |t is pro|cessed t|
|00003da0| 6f 20 6d 61 6b 65 20 73 | 75 72 65 0d 09 74 68 65 |o make s|ure..the|
|00003db0| 20 63 75 72 73 6f 72 20 | 69 73 20 74 68 65 20 72 | cursor |is the r|
|00003dc0| 69 67 68 74 20 6f 6e 65 | 2e 20 49 6e 20 61 6e 79 |ight one|. In any|
|00003dd0| 20 28 61 68 65 6d 29 20 | 65 76 65 6e 74 2c 20 74 | (ahem) |event, t|
|00003de0| 68 69 73 20 69 73 20 63 | 61 6c 6c 65 64 20 61 67 |his is c|alled ag|
|00003df0| 61 69 6e 20 62 65 66 6f | 72 65 20 77 65 0d 09 66 |ain befo|re we..f|
|00003e00| 61 6c 6c 20 62 61 63 6b | 20 69 6e 74 6f 20 57 4e |all back| into WN|
|00003e10| 45 2e 20 2a 2f 0d 0d 23 | 64 65 66 69 6e 65 20 5f |E. */..#|define _|
|00003e20| 5f 53 45 47 5f 5f 20 4d | 61 69 6e 0d 76 6f 69 64 |_SEG__ M|ain.void|
|00003e30| 20 41 64 6a 75 73 74 43 | 75 72 73 6f 72 28 6d 6f | AdjustC|ursor(mo|
|00003e40| 75 73 65 2c 72 65 67 69 | 6f 6e 29 0d 09 50 6f 69 |use,regi|on)..Poi|
|00003e50| 6e 74 09 09 6d 6f 75 73 | 65 3b 0d 09 52 67 6e 48 |nt..mous|e;..RgnH|
|00003e60| 61 6e 64 6c 65 09 72 65 | 67 69 6f 6e 3b 0d 7b 0d |andle.re|gion;.{.|
|00003e70| 09 57 69 6e 64 6f 77 50 | 74 72 09 77 69 6e 64 6f |.WindowP|tr.windo|
|00003e80| 77 3b 0d 09 52 67 6e 48 | 61 6e 64 6c 65 09 61 72 |w;..RgnH|andle.ar|
|00003e90| 72 6f 77 52 67 6e 3b 0d | 09 52 67 6e 48 61 6e 64 |rowRgn;.|.RgnHand|
|00003ea0| 6c 65 09 69 42 65 61 6d | 52 67 6e 3b 0d 09 52 65 |le.iBeam|Rgn;..Re|
|00003eb0| 63 74 09 09 69 42 65 61 | 6d 52 65 63 74 3b 0d 0d |ct..iBea|mRect;..|
|00003ec0| 09 77 69 6e 64 6f 77 20 | 3d 20 46 72 6f 6e 74 57 |.window |= FrontW|
|00003ed0| 69 6e 64 6f 77 28 29 3b | 09 2f 2a 20 77 65 20 6f |indow();|./* we o|
|00003ee0| 6e 6c 79 20 61 64 6a 75 | 73 74 20 74 68 65 20 63 |nly adju|st the c|
|00003ef0| 75 72 73 6f 72 20 77 68 | 65 6e 20 77 65 20 61 72 |ursor wh|en we ar|
|00003f00| 65 20 69 6e 20 66 72 6f | 6e 74 20 2a 2f 0d 09 69 |e in fro|nt */..i|
|00003f10| 66 20 28 20 28 21 20 67 | 49 6e 42 61 63 6b 67 72 |f ( (! g|InBackgr|
|00003f20| 6f 75 6e 64 29 20 26 26 | 20 28 21 20 49 73 44 41 |ound) &&| (! IsDA|
|00003f30| 57 69 6e 64 6f 77 28 77 | 69 6e 64 6f 77 29 29 20 |Window(w|indow)) |
|00003f40| 29 20 7b 0d 09 09 2f 2a | 20 63 61 6c 63 75 6c 61 |) {.../*| calcula|
|00003f50| 74 65 20 72 65 67 69 6f | 6e 73 20 66 6f 72 20 64 |te regio|ns for d|
|00003f60| 69 66 66 65 72 65 6e 74 | 20 63 75 72 73 6f 72 20 |ifferent| cursor |
|00003f70| 73 68 61 70 65 73 20 2a | 2f 0d 09 09 61 72 72 6f |shapes *|/...arro|
|00003f80| 77 52 67 6e 20 3d 20 4e | 65 77 52 67 6e 28 29 3b |wRgn = N|ewRgn();|
|00003f90| 0d 09 09 69 42 65 61 6d | 52 67 6e 20 3d 20 4e 65 |...iBeam|Rgn = Ne|
|00003fa0| 77 52 67 6e 28 29 3b 0d | 0d 09 09 2f 2a 20 73 74 |wRgn();.|.../* st|
|00003fb0| 61 72 74 20 61 72 72 6f | 77 52 67 6e 20 77 69 64 |art arro|wRgn wid|
|00003fc0| 65 20 6f 70 65 6e 20 2a | 2f 0d 09 09 53 65 74 52 |e open *|/...SetR|
|00003fd0| 65 63 74 52 67 6e 28 61 | 72 72 6f 77 52 67 6e 2c |ectRgn(a|rrowRgn,|
|00003fe0| 20 6b 45 78 74 72 65 6d | 65 4e 65 67 2c 20 6b 45 | kExtrem|eNeg, kE|
|00003ff0| 78 74 72 65 6d 65 4e 65 | 67 2c 20 6b 45 78 74 72 |xtremeNe|g, kExtr|
|00004000| 65 6d 65 50 6f 73 2c 20 | 6b 45 78 74 72 65 6d 65 |emePos, |kExtreme|
|00004010| 50 6f 73 29 3b 0d 0d 09 | 09 2f 2a 20 63 61 6c 63 |Pos);...|./* calc|
|00004020| 75 6c 61 74 65 20 69 42 | 65 61 6d 52 67 6e 20 2a |ulate iB|eamRgn *|
|00004030| 2f 0d 09 09 69 66 20 28 | 20 49 73 41 70 70 57 69 |/...if (| IsAppWi|
|00004040| 6e 64 6f 77 28 77 69 6e | 64 6f 77 29 20 29 20 7b |ndow(win|dow) ) {|
|00004050| 0d 09 09 09 69 42 65 61 | 6d 52 65 63 74 20 3d 20 |....iBea|mRect = |
|00004060| 28 2a 28 28 44 6f 63 75 | 6d 65 6e 74 50 65 65 6b |(*((Docu|mentPeek|
|00004070| 29 20 77 69 6e 64 6f 77 | 29 2d 3e 64 6f 63 54 45 |) window|)->docTE|
|00004080| 29 2d 3e 76 69 65 77 52 | 65 63 74 3b 0d 09 09 09 |)->viewR|ect;....|
|00004090| 53 65 74 50 6f 72 74 28 | 77 69 6e 64 6f 77 29 3b |SetPort(|window);|
|000040a0| 09 2f 2a 20 6d 61 6b 65 | 20 61 20 67 6c 6f 62 61 |./* make| a globa|
|000040b0| 6c 20 76 65 72 73 69 6f | 6e 20 6f 66 20 74 68 65 |l versio|n of the|
|000040c0| 20 76 69 65 77 52 65 63 | 74 20 2a 2f 0d 09 09 09 | viewRec|t */....|
|000040d0| 4c 6f 63 61 6c 54 6f 47 | 6c 6f 62 61 6c 28 26 54 |LocalToG|lobal(&T|
|000040e0| 6f 70 4c 65 66 74 28 69 | 42 65 61 6d 52 65 63 74 |opLeft(i|BeamRect|
|000040f0| 29 29 3b 0d 09 09 09 4c | 6f 63 61 6c 54 6f 47 6c |));....L|ocalToGl|
|00004100| 6f 62 61 6c 28 26 42 6f | 74 52 69 67 68 74 28 69 |obal(&Bo|tRight(i|
|00004110| 42 65 61 6d 52 65 63 74 | 29 29 3b 0d 09 09 09 52 |BeamRect|));....R|
|00004120| 65 63 74 52 67 6e 28 69 | 42 65 61 6d 52 67 6e 2c |ectRgn(i|BeamRgn,|
|00004130| 20 26 69 42 65 61 6d 52 | 65 63 74 29 3b 0d 09 09 | &iBeamR|ect);...|
|00004140| 09 2f 2a 20 77 65 20 74 | 65 6d 70 6f 72 61 72 69 |./* we t|emporari|
|00004150| 6c 79 20 63 68 61 6e 67 | 65 20 74 68 65 20 70 6f |ly chang|e the po|
|00004160| 72 74 d5 73 20 6f 72 69 | 67 69 6e 20 74 6f 20 d2 |rt.s ori|gin to .|
|00004170| 67 6c 6f 62 61 6c 66 79 | d3 20 74 68 65 20 76 69 |globalfy|. the vi|
|00004180| 73 52 67 6e 20 2a 2f 0d | 09 09 09 53 65 74 4f 72 |sRgn */.|...SetOr|
|00004190| 69 67 69 6e 28 2d 77 69 | 6e 64 6f 77 2d 3e 70 6f |igin(-wi|ndow->po|
|000041a0| 72 74 42 69 74 73 2e 62 | 6f 75 6e 64 73 2e 6c 65 |rtBits.b|ounds.le|
|000041b0| 66 74 2c 20 2d 77 69 6e | 64 6f 77 2d 3e 70 6f 72 |ft, -win|dow->por|
|000041c0| 74 42 69 74 73 2e 62 6f | 75 6e 64 73 2e 74 6f 70 |tBits.bo|unds.top|
|000041d0| 29 3b 0d 09 09 09 53 65 | 63 74 52 67 6e 28 69 42 |);....Se|ctRgn(iB|
|000041e0| 65 61 6d 52 67 6e 2c 20 | 77 69 6e 64 6f 77 2d 3e |eamRgn, |window->|
|000041f0| 76 69 73 52 67 6e 2c 20 | 69 42 65 61 6d 52 67 6e |visRgn, |iBeamRgn|
|00004200| 29 3b 0d 09 09 09 53 65 | 74 4f 72 69 67 69 6e 28 |);....Se|tOrigin(|
|00004210| 30 2c 20 30 29 3b 0d 09 | 09 7d 0d 0d 09 09 2f 2a |0, 0);..|.}..../*|
|00004220| 20 73 75 62 74 72 61 63 | 74 20 6f 74 68 65 72 20 | subtrac|t other |
|00004230| 72 65 67 69 6f 6e 73 20 | 66 72 6f 6d 20 61 72 72 |regions |from arr|
|00004240| 6f 77 52 67 6e 20 2a 2f | 0d 09 09 44 69 66 66 52 |owRgn */|...DiffR|
|00004250| 67 6e 28 61 72 72 6f 77 | 52 67 6e 2c 20 69 42 65 |gn(arrow|Rgn, iBe|
|00004260| 61 6d 52 67 6e 2c 20 61 | 72 72 6f 77 52 67 6e 29 |amRgn, a|rrowRgn)|
|00004270| 3b 0d 0d 09 09 2f 2a 20 | 63 68 61 6e 67 65 20 74 |;..../* |change t|
|00004280| 68 65 20 63 75 72 73 6f | 72 20 61 6e 64 20 74 68 |he curso|r and th|
|00004290| 65 20 72 65 67 69 6f 6e | 20 70 61 72 61 6d 65 74 |e region| paramet|
|000042a0| 65 72 20 2a 2f 0d 09 09 | 69 66 20 28 20 50 74 49 |er */...|if ( PtI|
|000042b0| 6e 52 67 6e 28 6d 6f 75 | 73 65 2c 20 69 42 65 61 |nRgn(mou|se, iBea|
|000042c0| 6d 52 67 6e 29 20 29 20 | 7b 0d 09 09 09 53 65 74 |mRgn) ) |{....Set|
|000042d0| 43 75 72 73 6f 72 28 2a | 47 65 74 43 75 72 73 6f |Cursor(*|GetCurso|
|000042e0| 72 28 69 42 65 61 6d 43 | 75 72 73 6f 72 29 29 3b |r(iBeamC|ursor));|
|000042f0| 0d 09 09 09 43 6f 70 79 | 52 67 6e 28 69 42 65 61 |....Copy|Rgn(iBea|
|00004300| 6d 52 67 6e 2c 20 72 65 | 67 69 6f 6e 29 3b 0d 09 |mRgn, re|gion);..|
|00004310| 09 7d 20 65 6c 73 65 20 | 7b 0d 09 09 09 53 65 74 |.} else |{....Set|
|00004320| 43 75 72 73 6f 72 28 26 | 71 64 2e 61 72 72 6f 77 |Cursor(&|qd.arrow|
|00004330| 29 3b 0d 09 09 09 43 6f | 70 79 52 67 6e 28 61 72 |);....Co|pyRgn(ar|
|00004340| 72 6f 77 52 67 6e 2c 20 | 72 65 67 69 6f 6e 29 3b |rowRgn, |region);|
|00004350| 0d 09 09 7d 0d 0d 09 09 | 44 69 73 70 6f 73 65 52 |...}....|DisposeR|
|00004360| 67 6e 28 61 72 72 6f 77 | 52 67 6e 29 3b 0d 09 09 |gn(arrow|Rgn);...|
|00004370| 44 69 73 70 6f 73 65 52 | 67 6e 28 69 42 65 61 6d |DisposeR|gn(iBeam|
|00004380| 52 67 6e 29 3b 0d 09 7d | 0d 7d 20 2f 2a 41 64 6a |Rgn);..}|.} /*Adj|
|00004390| 75 73 74 43 75 72 73 6f | 72 2a 2f 0d 0d 0d 2f 2a |ustCurso|r*/.../*|
|000043a0| 09 43 61 6c 6c 65 64 20 | 77 68 65 6e 20 61 20 6d |.Called |when a m|
|000043b0| 6f 75 73 65 44 6f 77 6e | 20 6f 63 63 75 72 73 20 |ouseDown| occurs |
|000043c0| 69 6e 20 74 68 65 20 67 | 72 6f 77 20 62 6f 78 20 |in the g|row box |
|000043d0| 6f 66 20 61 6e 20 61 63 | 74 69 76 65 20 77 69 6e |of an ac|tive win|
|000043e0| 64 6f 77 2e 20 49 6e 0d | 09 6f 72 64 65 72 20 74 |dow. In.|.order t|
|000043f0| 6f 20 65 6c 69 6d 69 6e | 61 74 65 20 61 6e 79 20 |o elimin|ate any |
|00004400| 27 66 6c 69 63 6b 65 72 | 27 2c 20 77 65 20 77 61 |'flicker|', we wa|
|00004410| 6e 74 20 74 6f 20 69 6e | 76 61 6c 69 64 61 74 65 |nt to in|validate|
|00004420| 20 6f 6e 6c 79 20 77 68 | 61 74 20 69 73 0d 09 6e | only wh|at is..n|
|00004430| 65 63 65 73 73 61 72 79 | 2e 20 53 69 6e 63 65 20 |ecessary|. Since |
|00004440| 52 65 73 69 7a 65 57 69 | 6e 64 6f 77 20 69 6e 76 |ResizeWi|ndow inv|
|00004450| 61 6c 69 64 61 74 65 73 | 20 74 68 65 20 77 68 6f |alidates| the who|
|00004460| 6c 65 20 70 6f 72 74 52 | 65 63 74 2c 20 77 65 20 |le portR|ect, we |
|00004470| 73 61 76 65 0d 09 74 68 | 65 20 6f 6c 64 20 54 45 |save..th|e old TE|
|00004480| 20 76 69 65 77 52 65 63 | 74 2c 20 69 6e 74 65 72 | viewRec|t, inter|
|00004490| 73 65 63 74 20 69 74 20 | 77 69 74 68 20 74 68 65 |sect it |with the|
|000044a0| 20 6e 65 77 20 54 45 20 | 76 69 65 77 52 65 63 74 | new TE |viewRect|
|000044b0| 2c 20 61 6e 64 0d 09 72 | 65 6d 6f 76 65 20 74 68 |, and..r|emove th|
|000044c0| 65 20 72 65 73 75 6c 74 | 20 66 72 6f 6d 20 74 68 |e result| from th|
|000044d0| 65 20 75 70 64 61 74 65 | 20 72 65 67 69 6f 6e 2e |e update| region.|
|000044e0| 20 48 6f 77 65 76 65 72 | 2c 20 77 65 20 6d 75 73 | However|, we mus|
|000044f0| 74 20 6d 61 6b 65 20 73 | 75 72 65 0d 09 74 68 61 |t make s|ure..tha|
|00004500| 74 20 61 6e 79 20 6f 6c | 64 20 75 70 64 61 74 65 |t any ol|d update|
|00004510| 20 72 65 67 69 6f 6e 20 | 74 68 61 74 20 6d 69 67 | region |that mig|
|00004520| 68 74 20 68 61 76 65 20 | 62 65 65 6e 20 61 72 6f |ht have |been aro|
|00004530| 75 6e 64 20 67 65 74 73 | 20 70 75 74 20 62 61 63 |und gets| put bac|
|00004540| 6b 2e 20 2a 2f 0d 0d 23 | 64 65 66 69 6e 65 20 5f |k. */..#|define _|
|00004550| 5f 53 45 47 5f 5f 20 4d | 61 69 6e 0d 76 6f 69 64 |_SEG__ M|ain.void|
|00004560| 20 44 6f 47 72 6f 77 57 | 69 6e 64 6f 77 28 77 69 | DoGrowW|indow(wi|
|00004570| 6e 64 6f 77 2c 65 76 65 | 6e 74 29 0d 09 57 69 6e |ndow,eve|nt)..Win|
|00004580| 64 6f 77 50 74 72 09 77 | 69 6e 64 6f 77 3b 0d 09 |dowPtr.w|indow;..|
|00004590| 45 76 65 6e 74 52 65 63 | 6f 72 64 09 2a 65 76 65 |EventRec|ord.*eve|
|000045a0| 6e 74 3b 0d 7b 0d 09 6c | 6f 6e 67 09 09 67 72 6f |nt;.{..l|ong..gro|
|000045b0| 77 52 65 73 75 6c 74 3b | 0d 09 52 65 63 74 09 09 |wResult;|..Rect..|
|000045c0| 74 65 6d 70 52 65 63 74 | 3b 0d 09 52 67 6e 48 61 |tempRect|;..RgnHa|
|000045d0| 6e 64 6c 65 09 74 65 6d | 70 52 67 6e 3b 0d 09 44 |ndle.tem|pRgn;..D|
|000045e0| 6f 63 75 6d 65 6e 74 50 | 65 65 6b 20 64 6f 63 3b |ocumentP|eek doc;|
|000045f0| 0d 09 0d 09 74 65 6d 70 | 52 65 63 74 20 3d 20 71 |....temp|Rect = q|
|00004600| 64 2e 73 63 72 65 65 6e | 42 69 74 73 2e 62 6f 75 |d.screen|Bits.bou|
|00004610| 6e 64 73 3b 09 09 09 09 | 09 2f 2a 20 73 65 74 20 |nds;....|./* set |
|00004620| 75 70 20 6c 69 6d 69 74 | 69 6e 67 20 76 61 6c 75 |up limit|ing valu|
|00004630| 65 73 20 2a 2f 0d 09 74 | 65 6d 70 52 65 63 74 2e |es */..t|empRect.|
|00004640| 6c 65 66 74 20 3d 20 6b | 4d 69 6e 44 6f 63 44 69 |left = k|MinDocDi|
|00004650| 6d 3b 0d 09 74 65 6d 70 | 52 65 63 74 2e 74 6f 70 |m;..temp|Rect.top|
|00004660| 20 3d 20 6b 4d 69 6e 44 | 6f 63 44 69 6d 3b 0d 09 | = kMinD|ocDim;..|
|00004670| 67 72 6f 77 52 65 73 75 | 6c 74 20 3d 20 47 72 6f |growResu|lt = Gro|
|00004680| 77 57 69 6e 64 6f 77 28 | 77 69 6e 64 6f 77 2c 20 |wWindow(|window, |
|00004690| 65 76 65 6e 74 2d 3e 77 | 68 65 72 65 2c 20 26 74 |event->w|here, &t|
|000046a0| 65 6d 70 52 65 63 74 29 | 3b 0d 09 2f 2a 20 73 65 |empRect)|;../* se|
|000046b0| 65 20 69 66 20 69 74 20 | 72 65 61 6c 6c 79 20 63 |e if it |really c|
|000046c0| 68 61 6e 67 65 64 20 73 | 69 7a 65 20 2a 2f 0d 09 |hanged s|ize */..|
|000046d0| 69 66 20 28 20 67 72 6f | 77 52 65 73 75 6c 74 20 |if ( gro|wResult |
|000046e0| 21 3d 20 30 20 29 20 7b | 0d 09 09 64 6f 63 20 3d |!= 0 ) {|...doc =|
|000046f0| 20 28 44 6f 63 75 6d 65 | 6e 74 50 65 65 6b 29 20 | (Docume|ntPeek) |
|00004700| 77 69 6e 64 6f 77 3b 0d | 09 09 74 65 6d 70 52 65 |window;.|..tempRe|
|00004710| 63 74 20 3d 20 28 2a 64 | 6f 63 2d 3e 64 6f 63 54 |ct = (*d|oc->docT|
|00004720| 45 29 2d 3e 76 69 65 77 | 52 65 63 74 3b 09 09 09 |E)->view|Rect;...|
|00004730| 09 2f 2a 20 73 61 76 65 | 20 6f 6c 64 20 74 65 78 |./* save| old tex|
|00004740| 74 20 62 6f 78 20 2a 2f | 0d 09 09 74 65 6d 70 52 |t box */|...tempR|
|00004750| 67 6e 20 3d 20 4e 65 77 | 52 67 6e 28 29 3b 0d 09 |gn = New|Rgn();..|
|00004760| 09 47 65 74 4c 6f 63 61 | 6c 55 70 64 61 74 65 52 |.GetLoca|lUpdateR|
|00004770| 67 6e 28 77 69 6e 64 6f | 77 2c 20 74 65 6d 70 52 |gn(windo|w, tempR|
|00004780| 67 6e 29 3b 09 09 09 09 | 2f 2a 20 67 65 74 20 6c |gn);....|/* get l|
|00004790| 6f 63 61 6c 69 7a 65 64 | 20 75 70 64 61 74 65 20 |ocalized| update |
|000047a0| 72 65 67 69 6f 6e 20 2a | 2f 0d 09 09 53 69 7a 65 |region *|/...Size|
|000047b0| 57 69 6e 64 6f 77 28 77 | 69 6e 64 6f 77 2c 20 4c |Window(w|indow, L|
|000047c0| 6f 57 72 64 28 67 72 6f | 77 52 65 73 75 6c 74 29 |oWrd(gro|wResult)|
|000047d0| 2c 20 48 69 57 72 64 28 | 67 72 6f 77 52 65 73 75 |, HiWrd(|growResu|
|000047e0| 6c 74 29 2c 20 74 72 75 | 65 29 3b 0d 09 09 52 65 |lt), tru|e);...Re|
|000047f0| 73 69 7a 65 57 69 6e 64 | 6f 77 28 77 69 6e 64 6f |sizeWind|ow(windo|
|00004800| 77 29 3b 0d 09 09 2f 2a | 20 63 61 6c 63 75 6c 61 |w);.../*| calcula|
|00004810| 74 65 20 26 20 76 61 6c | 69 64 61 74 65 20 74 68 |te & val|idate th|
|00004820| 65 20 72 65 67 69 6f 6e | 20 74 68 61 74 20 68 61 |e region| that ha|
|00004830| 73 6e d5 74 20 63 68 61 | 6e 67 65 64 20 73 6f 20 |sn.t cha|nged so |
|00004840| 69 74 20 77 6f 6e d5 74 | 20 67 65 74 20 72 65 64 |it won.t| get red|
|00004850| 72 61 77 6e 20 2a 2f 0d | 09 09 53 65 63 74 52 65 |rawn */.|..SectRe|
|00004860| 63 74 28 26 74 65 6d 70 | 52 65 63 74 2c 20 26 28 |ct(&temp|Rect, &(|
|00004870| 2a 64 6f 63 2d 3e 64 6f | 63 54 45 29 2d 3e 76 69 |*doc->do|cTE)->vi|
|00004880| 65 77 52 65 63 74 2c 20 | 26 74 65 6d 70 52 65 63 |ewRect, |&tempRec|
|00004890| 74 29 3b 0d 09 09 56 61 | 6c 69 64 52 65 63 74 28 |t);...Va|lidRect(|
|000048a0| 26 74 65 6d 70 52 65 63 | 74 29 3b 09 09 09 09 09 |&tempRec|t);.....|
|000048b0| 09 09 2f 2a 20 74 61 6b | 65 20 69 74 20 6f 75 74 |../* tak|e it out|
|000048c0| 20 6f 66 20 75 70 64 61 | 74 65 20 2a 2f 0d 09 09 | of upda|te */...|
|000048d0| 49 6e 76 61 6c 52 67 6e | 28 74 65 6d 70 52 67 6e |InvalRgn|(tempRgn|
|000048e0| 29 3b 09 09 09 09 09 09 | 09 09 2f 2a 20 70 75 74 |);......|../* put|
|000048f0| 20 62 61 63 6b 20 61 6e | 79 20 70 72 69 6f 72 20 | back an|y prior |
|00004900| 75 70 64 61 74 65 20 2a | 2f 0d 09 09 44 69 73 70 |update *|/...Disp|
|00004910| 6f 73 65 52 67 6e 28 74 | 65 6d 70 52 67 6e 29 3b |oseRgn(t|empRgn);|
|00004920| 0d 09 7d 0d 7d 20 2f 2a | 20 44 6f 47 72 6f 77 57 |..}.} /*| DoGrowW|
|00004930| 69 6e 64 6f 77 20 2a 2f | 0d 0d 0d 2f 2a 20 09 43 |indow */|.../* .C|
|00004940| 61 6c 6c 65 64 20 77 68 | 65 6e 20 61 20 6d 6f 75 |alled wh|en a mou|
|00004950| 73 65 43 6c 69 63 6b 20 | 6f 63 63 75 72 73 20 69 |seClick |occurs i|
|00004960| 6e 20 74 68 65 20 7a 6f | 6f 6d 20 62 6f 78 20 6f |n the zo|om box o|
|00004970| 66 20 61 6e 20 61 63 74 | 69 76 65 20 77 69 6e 64 |f an act|ive wind|
|00004980| 6f 77 2e 0d 09 45 76 65 | 72 79 74 68 69 6e 67 20 |ow...Eve|rything |
|00004990| 68 61 73 20 74 6f 20 67 | 65 74 20 72 65 2d 64 72 |has to g|et re-dr|
|000049a0| 61 77 6e 20 68 65 72 65 | 2c 20 73 6f 20 77 65 20 |awn here|, so we |
|000049b0| 64 6f 6e 27 74 20 6d 69 | 6e 64 20 74 68 61 74 0d |don't mi|nd that.|
|000049c0| 09 52 65 73 69 7a 65 57 | 69 6e 64 6f 77 20 69 6e |.ResizeW|indow in|
|000049d0| 76 61 6c 69 64 61 74 65 | 73 20 74 68 65 20 77 68 |validate|s the wh|
|000049e0| 6f 6c 65 20 70 6f 72 74 | 52 65 63 74 2e 20 2a 2f |ole port|Rect. */|
|000049f0| 0d 0d 23 64 65 66 69 6e | 65 20 5f 5f 53 45 47 5f |..#defin|e __SEG_|
|00004a00| 5f 20 4d 61 69 6e 0d 76 | 6f 69 64 20 44 6f 5a 6f |_ Main.v|oid DoZo|
|00004a10| 6f 6d 57 69 6e 64 6f 77 | 28 77 69 6e 64 6f 77 2c |omWindow|(window,|
|00004a20| 70 61 72 74 29 0d 09 57 | 69 6e 64 6f 77 50 74 72 |part)..W|indowPtr|
|00004a30| 09 77 69 6e 64 6f 77 3b | 0d 09 73 68 6f 72 74 09 |.window;|..short.|
|00004a40| 09 70 61 72 74 3b 0d 7b | 0d 09 45 72 61 73 65 52 |.part;.{|..EraseR|
|00004a50| 65 63 74 28 26 77 69 6e | 64 6f 77 2d 3e 70 6f 72 |ect(&win|dow->por|
|00004a60| 74 52 65 63 74 29 3b 0d | 09 5a 6f 6f 6d 57 69 6e |tRect);.|.ZoomWin|
|00004a70| 64 6f 77 28 77 69 6e 64 | 6f 77 2c 20 70 61 72 74 |dow(wind|ow, part|
|00004a80| 2c 20 77 69 6e 64 6f 77 | 20 3d 3d 20 46 72 6f 6e |, window| == Fron|
|00004a90| 74 57 69 6e 64 6f 77 28 | 29 29 3b 0d 09 52 65 73 |tWindow(|));..Res|
|00004aa0| 69 7a 65 57 69 6e 64 6f | 77 28 77 69 6e 64 6f 77 |izeWindo|w(window|
|00004ab0| 29 3b 0d 7d 20 2f 2a 20 | 20 44 6f 5a 6f 6f 6d 57 |);.} /* | DoZoomW|
|00004ac0| 69 6e 64 6f 77 20 2a 2f | 0d 0d 0d 2f 2a 20 43 61 |indow */|.../* Ca|
|00004ad0| 6c 6c 65 64 20 77 68 65 | 6e 20 74 68 65 20 77 69 |lled whe|n the wi|
|00004ae0| 6e 64 6f 77 20 68 61 73 | 20 62 65 65 6e 20 72 65 |ndow has| been re|
|00004af0| 73 69 7a 65 64 20 74 6f | 20 66 69 78 20 75 70 20 |sized to| fix up |
|00004b00| 74 68 65 20 63 6f 6e 74 | 72 6f 6c 73 20 61 6e 64 |the cont|rols and|
|00004b10| 20 63 6f 6e 74 65 6e 74 | 2e 20 2a 2f 0d 23 64 65 | content|. */.#de|
|00004b20| 66 69 6e 65 20 5f 5f 53 | 45 47 5f 5f 20 4d 61 69 |fine __S|EG__ Mai|
|00004b30| 6e 0d 76 6f 69 64 20 52 | 65 73 69 7a 65 57 69 6e |n.void R|esizeWin|
|00004b40| 64 6f 77 28 77 69 6e 64 | 6f 77 29 0d 09 57 69 6e |dow(wind|ow)..Win|
|00004b50| 64 6f 77 50 74 72 09 77 | 69 6e 64 6f 77 3b 0d 7b |dowPtr.w|indow;.{|
|00004b60| 0d 09 41 64 6a 75 73 74 | 53 63 72 6f 6c 6c 62 61 |..Adjust|Scrollba|
|00004b70| 72 73 28 77 69 6e 64 6f | 77 2c 20 74 72 75 65 29 |rs(windo|w, true)|
|00004b80| 3b 0d 09 41 64 6a 75 73 | 74 54 45 28 77 69 6e 64 |;..Adjus|tTE(wind|
|00004b90| 6f 77 29 3b 0d 09 49 6e | 76 61 6c 52 65 63 74 28 |ow);..In|valRect(|
|00004ba0| 26 77 69 6e 64 6f 77 2d | 3e 70 6f 72 74 52 65 63 |&window-|>portRec|
|00004bb0| 74 29 3b 0d 7d 20 2f 2a | 20 52 65 73 69 7a 65 57 |t);.} /*| ResizeW|
|00004bc0| 69 6e 64 6f 77 20 2a 2f | 0d 0d 0d 2f 2a 20 52 65 |indow */|.../* Re|
|00004bd0| 74 75 72 6e 73 20 74 68 | 65 20 75 70 64 61 74 65 |turns th|e update|
|00004be0| 20 72 65 67 69 6f 6e 20 | 69 6e 20 6c 6f 63 61 6c | region |in local|
|00004bf0| 20 63 6f 6f 72 64 69 6e | 61 74 65 73 20 2a 2f 0d | coordin|ates */.|
|00004c00| 23 64 65 66 69 6e 65 20 | 5f 5f 53 45 47 5f 5f 20 |#define |__SEG__ |
|00004c10| 4d 61 69 6e 0d 76 6f 69 | 64 20 47 65 74 4c 6f 63 |Main.voi|d GetLoc|
|00004c20| 61 6c 55 70 64 61 74 65 | 52 67 6e 28 77 69 6e 64 |alUpdate|Rgn(wind|
|00004c30| 6f 77 2c 6c 6f 63 61 6c | 52 67 6e 29 0d 09 57 69 |ow,local|Rgn)..Wi|
|00004c40| 6e 64 6f 77 50 74 72 09 | 77 69 6e 64 6f 77 3b 0d |ndowPtr.|window;.|
|00004c50| 09 52 67 6e 48 61 6e 64 | 6c 65 09 6c 6f 63 61 6c |.RgnHand|le.local|
|00004c60| 52 67 6e 3b 0d 7b 0d 09 | 43 6f 70 79 52 67 6e 28 |Rgn;.{..|CopyRgn(|
|00004c70| 28 28 57 69 6e 64 6f 77 | 50 65 65 6b 29 20 77 69 |((Window|Peek) wi|
|00004c80| 6e 64 6f 77 29 2d 3e 75 | 70 64 61 74 65 52 67 6e |ndow)->u|pdateRgn|
|00004c90| 2c 20 6c 6f 63 61 6c 52 | 67 6e 29 3b 09 2f 2a 20 |, localR|gn);./* |
|00004ca0| 73 61 76 65 20 6f 6c 64 | 20 75 70 64 61 74 65 20 |save old| update |
|00004cb0| 72 65 67 69 6f 6e 20 2a | 2f 0d 09 4f 66 66 73 65 |region *|/..Offse|
|00004cc0| 74 52 67 6e 28 6c 6f 63 | 61 6c 52 67 6e 2c 20 77 |tRgn(loc|alRgn, w|
|00004cd0| 69 6e 64 6f 77 2d 3e 70 | 6f 72 74 42 69 74 73 2e |indow->p|ortBits.|
|00004ce0| 62 6f 75 6e 64 73 2e 6c | 65 66 74 2c 20 77 69 6e |bounds.l|eft, win|
|00004cf0| 64 6f 77 2d 3e 70 6f 72 | 74 42 69 74 73 2e 62 6f |dow->por|tBits.bo|
|00004d00| 75 6e 64 73 2e 74 6f 70 | 29 3b 0d 7d 20 2f 2a 20 |unds.top|);.} /* |
|00004d10| 47 65 74 4c 6f 63 61 6c | 55 70 64 61 74 65 52 67 |GetLocal|UpdateRg|
|00004d20| 6e 20 2a 2f 0d 0d 0d 2f | 2a 09 54 68 69 73 20 69 |n */.../|*.This i|
|00004d30| 73 20 63 61 6c 6c 65 64 | 20 77 68 65 6e 20 61 6e |s called| when an|
|00004d40| 20 75 70 64 61 74 65 20 | 65 76 65 6e 74 20 69 73 | update |event is|
|00004d50| 20 72 65 63 65 69 76 65 | 64 20 66 6f 72 20 61 20 | receive|d for a |
|00004d60| 77 69 6e 64 6f 77 2e 0d | 09 49 74 20 63 61 6c 6c |window..|.It call|
|00004d70| 73 20 44 72 61 77 57 69 | 6e 64 6f 77 20 74 6f 20 |s DrawWi|ndow to |
|00004d80| 64 72 61 77 20 74 68 65 | 20 63 6f 6e 74 65 6e 74 |draw the| content|
|00004d90| 73 20 6f 66 20 61 6e 20 | 61 70 70 6c 69 63 61 74 |s of an |applicat|
|00004da0| 69 6f 6e 20 77 69 6e 64 | 6f 77 2e 0d 09 41 73 20 |ion wind|ow...As |
|00004db0| 61 6e 20 65 66 66 69 63 | 69 65 6e 63 79 20 6d 65 |an effic|iency me|
|00004dc0| 61 73 75 72 65 20 74 68 | 61 74 20 64 6f 65 73 20 |asure th|at does |
|00004dd0| 6e 6f 74 20 68 61 76 65 | 20 74 6f 20 62 65 20 66 |not have| to be f|
|00004de0| 6f 6c 6c 6f 77 65 64 2c | 20 69 74 0d 09 63 61 6c |ollowed,| it..cal|
|00004df0| 6c 73 20 74 68 65 20 64 | 72 61 77 69 6e 67 20 72 |ls the d|rawing r|
|00004e00| 6f 75 74 69 6e 65 20 6f | 6e 6c 79 20 69 66 20 74 |outine o|nly if t|
|00004e10| 68 65 20 76 69 73 52 67 | 6e 20 69 73 20 6e 6f 6e |he visRg|n is non|
|00004e20| 2d 65 6d 70 74 79 2e 20 | 54 68 69 73 0d 09 77 69 |-empty. |This..wi|
|00004e30| 6c 6c 20 68 61 6e 64 6c | 65 20 73 69 74 75 61 74 |ll handl|e situat|
|00004e40| 69 6f 6e 73 20 77 68 65 | 72 65 20 63 61 6c 63 75 |ions whe|re calcu|
|00004e50| 6c 61 74 69 6f 6e 73 20 | 66 6f 72 20 64 72 61 77 |lations |for draw|
|00004e60| 69 6e 67 20 6f 72 20 64 | 72 61 77 69 6e 67 0d 09 |ing or d|rawing..|
|00004e70| 69 74 73 65 6c 66 20 69 | 73 20 76 65 72 79 20 74 |itself i|s very t|
|00004e80| 69 6d 65 2d 63 6f 6e 73 | 75 6d 69 6e 67 2e 20 2a |ime-cons|uming. *|
|00004e90| 2f 0d 0d 23 64 65 66 69 | 6e 65 20 5f 5f 53 45 47 |/..#defi|ne __SEG|
|00004ea0| 5f 5f 20 4d 61 69 6e 0d | 76 6f 69 64 20 44 6f 55 |__ Main.|void DoU|
|00004eb0| 70 64 61 74 65 28 77 69 | 6e 64 6f 77 29 0d 09 57 |pdate(wi|ndow)..W|
|00004ec0| 69 6e 64 6f 77 50 74 72 | 09 77 69 6e 64 6f 77 3b |indowPtr|.window;|
|00004ed0| 0d 7b 0d 09 69 66 20 28 | 20 49 73 41 70 70 57 69 |.{..if (| IsAppWi|
|00004ee0| 6e 64 6f 77 28 77 69 6e | 64 6f 77 29 20 29 20 7b |ndow(win|dow) ) {|
|00004ef0| 0d 09 09 42 65 67 69 6e | 55 70 64 61 74 65 28 77 |...Begin|Update(w|
|00004f00| 69 6e 64 6f 77 29 3b 09 | 09 09 09 2f 2a 20 74 68 |indow);.|.../* th|
|00004f10| 69 73 20 73 65 74 73 20 | 75 70 20 74 68 65 20 76 |is sets |up the v|
|00004f20| 69 73 52 67 6e 20 2a 2f | 0d 09 09 69 66 20 28 20 |isRgn */|...if ( |
|00004f30| 21 20 45 6d 70 74 79 52 | 67 6e 28 77 69 6e 64 6f |! EmptyR|gn(windo|
|00004f40| 77 2d 3e 76 69 73 52 67 | 6e 29 20 29 09 2f 2a 20 |w->visRg|n) )./* |
|00004f50| 64 72 61 77 20 69 66 20 | 75 70 64 61 74 69 6e 67 |draw if |updating|
|00004f60| 20 6e 65 65 64 73 20 74 | 6f 20 62 65 20 64 6f 6e | needs t|o be don|
|00004f70| 65 20 2a 2f 0d 09 09 09 | 44 72 61 77 57 69 6e 64 |e */....|DrawWind|
|00004f80| 6f 77 28 77 69 6e 64 6f | 77 29 3b 0d 09 09 45 6e |ow(windo|w);...En|
|00004f90| 64 55 70 64 61 74 65 28 | 77 69 6e 64 6f 77 29 3b |dUpdate(|window);|
|00004fa0| 0d 09 7d 0d 7d 20 2f 2a | 44 6f 55 70 64 61 74 65 |..}.} /*|DoUpdate|
|00004fb0| 2a 2f 0d 0d 0d 2f 2a 09 | 54 68 69 73 20 69 73 20 |*/.../*.|This is |
|00004fc0| 63 61 6c 6c 65 64 20 77 | 68 65 6e 20 61 20 77 69 |called w|hen a wi|
|00004fd0| 6e 64 6f 77 20 69 73 20 | 61 63 74 69 76 61 74 65 |ndow is |activate|
|00004fe0| 64 20 6f 72 20 64 65 61 | 63 74 69 76 61 74 65 64 |d or dea|ctivated|
|00004ff0| 2e 0d 09 49 74 20 63 61 | 6c 6c 73 20 54 65 78 74 |...It ca|lls Text|
|00005000| 45 64 69 74 20 74 6f 20 | 64 65 61 6c 20 77 69 74 |Edit to |deal wit|
|00005010| 68 20 74 68 65 20 73 65 | 6c 65 63 74 69 6f 6e 2e |h the se|lection.|
|00005020| 20 2a 2f 0d 0d 23 64 65 | 66 69 6e 65 20 5f 5f 53 | */..#de|fine __S|
|00005030| 45 47 5f 5f 20 4d 61 69 | 6e 0d 76 6f 69 64 20 44 |EG__ Mai|n.void D|
|00005040| 6f 41 63 74 69 76 61 74 | 65 28 77 69 6e 64 6f 77 |oActivat|e(window|
|00005050| 2c 20 62 65 63 6f 6d 69 | 6e 67 41 63 74 69 76 65 |, becomi|ngActive|
|00005060| 29 0d 09 57 69 6e 64 6f | 77 50 74 72 09 77 69 6e |)..Windo|wPtr.win|
|00005070| 64 6f 77 3b 0d 09 42 6f | 6f 6c 65 61 6e 09 09 62 |dow;..Bo|olean..b|
|00005080| 65 63 6f 6d 69 6e 67 41 | 63 74 69 76 65 3b 0d 7b |ecomingA|ctive;.{|
|00005090| 0d 09 52 67 6e 48 61 6e | 64 6c 65 09 74 65 6d 70 |..RgnHan|dle.temp|
|000050a0| 52 67 6e 2c 20 63 6c 69 | 70 52 67 6e 3b 0d 09 52 |Rgn, cli|pRgn;..R|
|000050b0| 65 63 74 09 09 67 72 6f | 77 52 65 63 74 3b 0d 09 |ect..gro|wRect;..|
|000050c0| 44 6f 63 75 6d 65 6e 74 | 50 65 65 6b 20 64 6f 63 |Document|Peek doc|
|000050d0| 3b 0d 09 0d 09 69 66 20 | 28 20 49 73 41 70 70 57 |;....if |( IsAppW|
|000050e0| 69 6e 64 6f 77 28 77 69 | 6e 64 6f 77 29 20 29 20 |indow(wi|ndow) ) |
|000050f0| 7b 0d 09 09 64 6f 63 20 | 3d 20 28 44 6f 63 75 6d |{...doc |= (Docum|
|00005100| 65 6e 74 50 65 65 6b 29 | 20 77 69 6e 64 6f 77 3b |entPeek)| window;|
|00005110| 0d 09 09 69 66 20 28 20 | 62 65 63 6f 6d 69 6e 67 |...if ( |becoming|
|00005120| 41 63 74 69 76 65 20 29 | 20 7b 0d 09 09 09 2f 2a |Active )| {..../*|
|00005130| 09 73 69 6e 63 65 20 77 | 65 20 64 6f 6e d5 74 20 |.since w|e don.t |
|00005140| 77 61 6e 74 20 54 45 41 | 63 74 69 76 61 74 65 20 |want TEA|ctivate |
|00005150| 74 6f 20 64 72 61 77 20 | 61 20 73 65 6c 65 63 74 |to draw |a select|
|00005160| 69 6f 6e 20 69 6e 20 61 | 6e 20 61 72 65 61 20 77 |ion in a|n area w|
|00005170| 68 65 72 65 0d 09 09 09 | 09 77 65 d5 72 65 20 67 |here....|.we.re g|
|00005180| 6f 69 6e 67 20 74 6f 20 | 65 72 61 73 65 20 61 6e |oing to |erase an|
|00005190| 64 20 72 65 64 72 61 77 | 2c 20 77 65 d5 6c 6c 20 |d redraw|, we.ll |
|000051a0| 63 6c 69 70 20 6f 75 74 | 20 74 68 65 20 75 70 64 |clip out| the upd|
|000051b0| 61 74 65 20 72 65 67 69 | 6f 6e 0d 09 09 09 09 62 |ate regi|on.....b|
|000051c0| 65 66 6f 72 65 20 63 61 | 6c 6c 69 6e 67 20 69 74 |efore ca|lling it|
|000051d0| 2e 20 2a 2f 0d 09 09 09 | 74 65 6d 70 52 67 6e 20 |. */....|tempRgn |
|000051e0| 3d 20 4e 65 77 52 67 6e | 28 29 3b 0d 09 09 09 63 |= NewRgn|();....c|
|000051f0| 6c 69 70 52 67 6e 20 3d | 20 4e 65 77 52 67 6e 28 |lipRgn =| NewRgn(|
|00005200| 29 3b 0d 09 09 09 47 65 | 74 4c 6f 63 61 6c 55 70 |);....Ge|tLocalUp|
|00005210| 64 61 74 65 52 67 6e 28 | 77 69 6e 64 6f 77 2c 20 |dateRgn(|window, |
|00005220| 74 65 6d 70 52 67 6e 29 | 3b 09 09 09 2f 2a 20 67 |tempRgn)|;.../* g|
|00005230| 65 74 20 6c 6f 63 61 6c | 69 7a 65 64 20 75 70 64 |et local|ized upd|
|00005240| 61 74 65 20 72 65 67 69 | 6f 6e 20 2a 2f 0d 09 09 |ate regi|on */...|
|00005250| 09 47 65 74 43 6c 69 70 | 28 63 6c 69 70 52 67 6e |.GetClip|(clipRgn|
|00005260| 29 3b 0d 09 09 09 44 69 | 66 66 52 67 6e 28 63 6c |);....Di|ffRgn(cl|
|00005270| 69 70 52 67 6e 2c 20 74 | 65 6d 70 52 67 6e 2c 20 |ipRgn, t|empRgn, |
|00005280| 74 65 6d 70 52 67 6e 29 | 3b 09 09 09 2f 2a 20 73 |tempRgn)|;.../* s|
|00005290| 75 62 74 72 61 63 74 20 | 75 70 64 61 74 65 52 67 |ubtract |updateRg|
|000052a0| 6e 20 66 72 6f 6d 20 63 | 6c 69 70 52 67 6e 20 2a |n from c|lipRgn *|
|000052b0| 2f 0d 09 09 09 53 65 74 | 43 6c 69 70 28 74 65 6d |/....Set|Clip(tem|
|000052c0| 70 52 67 6e 29 3b 0d 09 | 09 09 54 45 41 63 74 69 |pRgn);..|..TEActi|
|000052d0| 76 61 74 65 28 64 6f 63 | 2d 3e 64 6f 63 54 45 29 |vate(doc|->docTE)|
|000052e0| 3b 0d 09 09 09 53 65 74 | 43 6c 69 70 28 63 6c 69 |;....Set|Clip(cli|
|000052f0| 70 52 67 6e 29 3b 09 09 | 09 09 09 09 09 2f 2a 20 |pRgn);..|...../* |
|00005300| 72 65 73 74 6f 72 65 20 | 74 68 65 20 66 75 6c 6c |restore |the full|
|00005310| 2d 62 6c 6f 77 6e 20 63 | 6c 69 70 52 67 6e 20 2a |-blown c|lipRgn *|
|00005320| 2f 0d 09 09 09 44 69 73 | 70 6f 73 65 52 67 6e 28 |/....Dis|poseRgn(|
|00005330| 74 65 6d 70 52 67 6e 29 | 3b 0d 09 09 09 44 69 73 |tempRgn)|;....Dis|
|00005340| 70 6f 73 65 52 67 6e 28 | 63 6c 69 70 52 67 6e 29 |poseRgn(|clipRgn)|
|00005350| 3b 0d 09 09 09 0d 09 09 | 09 2f 2a 20 74 68 65 20 |;.......|./* the |
|00005360| 63 6f 6e 74 72 6f 6c 73 | 20 6d 75 73 74 20 62 65 |controls| must be|
|00005370| 20 72 65 64 72 61 77 6e | 20 6f 6e 20 61 63 74 69 | redrawn| on acti|
|00005380| 76 61 74 69 6f 6e 3a 20 | 2a 2f 0d 09 09 09 28 2a |vation: |*/....(*|
|00005390| 64 6f 63 2d 3e 64 6f 63 | 56 53 63 72 6f 6c 6c 29 |doc->doc|VScroll)|
|000053a0| 2d 3e 63 6f 6e 74 72 6c | 56 69 73 20 3d 20 6b 43 |->contrl|Vis = kC|
|000053b0| 6f 6e 74 72 6f 6c 56 69 | 73 69 62 6c 65 3b 0d 09 |ontrolVi|sible;..|
|000053c0| 09 09 28 2a 64 6f 63 2d | 3e 64 6f 63 48 53 63 72 |..(*doc-|>docHScr|
|000053d0| 6f 6c 6c 29 2d 3e 63 6f | 6e 74 72 6c 56 69 73 20 |oll)->co|ntrlVis |
|000053e0| 3d 20 6b 43 6f 6e 74 72 | 6f 6c 56 69 73 69 62 6c |= kContr|olVisibl|
|000053f0| 65 3b 0d 09 09 09 49 6e | 76 61 6c 52 65 63 74 28 |e;....In|valRect(|
|00005400| 26 28 2a 64 6f 63 2d 3e | 64 6f 63 56 53 63 72 6f |&(*doc->|docVScro|
|00005410| 6c 6c 29 2d 3e 63 6f 6e | 74 72 6c 52 65 63 74 29 |ll)->con|trlRect)|
|00005420| 3b 0d 09 09 09 49 6e 76 | 61 6c 52 65 63 74 28 26 |;....Inv|alRect(&|
|00005430| 28 2a 64 6f 63 2d 3e 64 | 6f 63 48 53 63 72 6f 6c |(*doc->d|ocHScrol|
|00005440| 6c 29 2d 3e 63 6f 6e 74 | 72 6c 52 65 63 74 29 3b |l)->cont|rlRect);|
|00005450| 0d 09 09 09 2f 2a 20 74 | 68 65 20 67 72 6f 77 62 |..../* t|he growb|
|00005460| 6f 78 20 6e 65 65 64 73 | 20 74 6f 20 62 65 20 72 |ox needs| to be r|
|00005470| 65 64 72 61 77 6e 20 6f | 6e 20 61 63 74 69 76 61 |edrawn o|n activa|
|00005480| 74 69 6f 6e 3a 20 2a 2f | 0d 09 09 09 67 72 6f 77 |tion: */|....grow|
|00005490| 52 65 63 74 20 3d 20 77 | 69 6e 64 6f 77 2d 3e 70 |Rect = w|indow->p|
|000054a0| 6f 72 74 52 65 63 74 3b | 0d 09 09 09 2f 2a 20 61 |ortRect;|..../* a|
|000054b0| 64 6a 75 73 74 20 66 6f | 72 20 74 68 65 20 73 63 |djust fo|r the sc|
|000054c0| 72 6f 6c 6c 62 61 72 73 | 20 2a 2f 0d 09 09 09 67 |rollbars| */....g|
|000054d0| 72 6f 77 52 65 63 74 2e | 74 6f 70 20 3d 20 67 72 |rowRect.|top = gr|
|000054e0| 6f 77 52 65 63 74 2e 62 | 6f 74 74 6f 6d 20 2d 20 |owRect.b|ottom - |
|000054f0| 6b 53 63 72 6f 6c 6c 62 | 61 72 41 64 6a 75 73 74 |kScrollb|arAdjust|
|00005500| 3b 0d 09 09 09 67 72 6f | 77 52 65 63 74 2e 6c 65 |;....gro|wRect.le|
|00005510| 66 74 20 3d 20 67 72 6f | 77 52 65 63 74 2e 72 69 |ft = gro|wRect.ri|
|00005520| 67 68 74 20 2d 20 6b 53 | 63 72 6f 6c 6c 62 61 72 |ght - kS|crollbar|
|00005530| 41 64 6a 75 73 74 3b 0d | 09 09 09 49 6e 76 61 6c |Adjust;.|...Inval|
|00005540| 52 65 63 74 28 26 67 72 | 6f 77 52 65 63 74 29 3b |Rect(&gr|owRect);|
|00005550| 0d 09 09 7d 0d 09 09 65 | 6c 73 65 20 7b 09 09 0d |...}...e|lse {...|
|00005560| 09 09 09 54 45 44 65 61 | 63 74 69 76 61 74 65 28 |...TEDea|ctivate(|
|00005570| 64 6f 63 2d 3e 64 6f 63 | 54 45 29 3b 0d 09 09 09 |doc->doc|TE);....|
|00005580| 2f 2a 20 74 68 65 20 63 | 6f 6e 74 72 6f 6c 73 20 |/* the c|ontrols |
|00005590| 6d 75 73 74 20 62 65 20 | 68 69 64 64 65 6e 20 6f |must be |hidden o|
|000055a0| 6e 20 64 65 61 63 74 69 | 76 61 74 69 6f 6e 3a 20 |n deacti|vation: |
|000055b0| 2a 2f 0d 09 09 09 48 69 | 64 65 43 6f 6e 74 72 6f |*/....Hi|deContro|
|000055c0| 6c 28 64 6f 63 2d 3e 64 | 6f 63 56 53 63 72 6f 6c |l(doc->d|ocVScrol|
|000055d0| 6c 29 3b 0d 09 09 09 48 | 69 64 65 43 6f 6e 74 72 |l);....H|ideContr|
|000055e0| 6f 6c 28 64 6f 63 2d 3e | 64 6f 63 48 53 63 72 6f |ol(doc->|docHScro|
|000055f0| 6c 6c 29 3b 0d 09 09 09 | 2f 2a 20 74 68 65 20 67 |ll);....|/* the g|
|00005600| 72 6f 77 62 6f 78 20 73 | 68 6f 75 6c 64 20 62 65 |rowbox s|hould be|
|00005610| 20 63 68 61 6e 67 65 64 | 20 69 6d 6d 65 64 69 61 | changed| immedia|
|00005620| 74 65 6c 79 20 6f 6e 20 | 64 65 61 63 74 69 76 61 |tely on |deactiva|
|00005630| 74 69 6f 6e 3a 20 2a 2f | 0d 09 09 09 44 72 61 77 |tion: */|....Draw|
|00005640| 47 72 6f 77 49 63 6f 6e | 28 77 69 6e 64 6f 77 29 |GrowIcon|(window)|
|00005650| 3b 0d 09 09 7d 0d 09 7d | 0d 7d 20 2f 2a 44 6f 41 |;...}..}|.} /*DoA|
|00005660| 63 74 69 76 61 74 65 2a | 2f 0d 0d 0d 2f 2a 09 54 |ctivate*|/.../*.T|
|00005670| 68 69 73 20 69 73 20 63 | 61 6c 6c 65 64 20 77 68 |his is c|alled wh|
|00005680| 65 6e 20 61 20 6d 6f 75 | 73 65 44 6f 77 6e 20 6f |en a mou|seDown o|
|00005690| 63 63 75 72 73 20 69 6e | 20 74 68 65 20 63 6f 6e |ccurs in| the con|
|000056a0| 74 65 6e 74 20 6f 66 20 | 61 20 77 69 6e 64 6f 77 |tent of |a window|
|000056b0| 2e 20 2a 2f 0d 0d 23 64 | 65 66 69 6e 65 20 5f 5f |. */..#d|efine __|
|000056c0| 53 45 47 5f 5f 20 4d 61 | 69 6e 0d 76 6f 69 64 20 |SEG__ Ma|in.void |
|000056d0| 44 6f 43 6f 6e 74 65 6e | 74 43 6c 69 63 6b 28 77 |DoConten|tClick(w|
|000056e0| 69 6e 64 6f 77 2c 65 76 | 65 6e 74 29 0d 09 57 69 |indow,ev|ent)..Wi|
|000056f0| 6e 64 6f 77 50 74 72 09 | 77 69 6e 64 6f 77 3b 0d |ndowPtr.|window;.|
|00005700| 09 45 76 65 6e 74 52 65 | 63 6f 72 64 09 2a 65 76 |.EventRe|cord.*ev|
|00005710| 65 6e 74 3b 0d 7b 0d 09 | 50 6f 69 6e 74 09 09 6d |ent;.{..|Point..m|
|00005720| 6f 75 73 65 3b 0d 09 43 | 6f 6e 74 72 6f 6c 48 61 |ouse;..C|ontrolHa|
|00005730| 6e 64 6c 65 20 63 6f 6e | 74 72 6f 6c 3b 0d 09 73 |ndle con|trol;..s|
|00005740| 68 6f 72 74 09 09 70 61 | 72 74 2c 20 76 61 6c 75 |hort..pa|rt, valu|
|00005750| 65 3b 0d 09 42 6f 6f 6c | 65 61 6e 09 09 73 68 69 |e;..Bool|ean..shi|
|00005760| 66 74 44 6f 77 6e 3b 0d | 09 44 6f 63 75 6d 65 6e |ftDown;.|.Documen|
|00005770| 74 50 65 65 6b 20 64 6f | 63 3b 0d 09 52 65 63 74 |tPeek do|c;..Rect|
|00005780| 09 09 74 65 52 65 63 74 | 3b 0d 0d 09 69 66 20 28 |..teRect|;...if (|
|00005790| 20 49 73 41 70 70 57 69 | 6e 64 6f 77 28 77 69 6e | IsAppWi|ndow(win|
|000057a0| 64 6f 77 29 20 29 20 7b | 0d 09 09 53 65 74 50 6f |dow) ) {|...SetPo|
|000057b0| 72 74 28 77 69 6e 64 6f | 77 29 3b 0d 09 09 6d 6f |rt(windo|w);...mo|
|000057c0| 75 73 65 20 3d 20 65 76 | 65 6e 74 2d 3e 77 68 65 |use = ev|ent->whe|
|000057d0| 72 65 3b 09 09 09 09 09 | 09 09 2f 2a 20 67 65 74 |re;.....|../* get|
|000057e0| 20 74 68 65 20 63 6c 69 | 63 6b 20 70 6f 73 69 74 | the cli|ck posit|
|000057f0| 69 6f 6e 20 2a 2f 0d 09 | 09 47 6c 6f 62 61 6c 54 |ion */..|.GlobalT|
|00005800| 6f 4c 6f 63 61 6c 28 26 | 6d 6f 75 73 65 29 3b 0d |oLocal(&|mouse);.|
|00005810| 09 09 64 6f 63 20 3d 20 | 28 44 6f 63 75 6d 65 6e |..doc = |(Documen|
|00005820| 74 50 65 65 6b 29 20 77 | 69 6e 64 6f 77 3b 0d 09 |tPeek) w|indow;..|
|00005830| 09 2f 2a 20 73 65 65 20 | 69 66 20 77 65 20 61 72 |./* see |if we ar|
|00005840| 65 20 69 6e 20 74 68 65 | 20 76 69 65 77 52 65 63 |e in the| viewRec|
|00005850| 74 2e 20 69 66 20 73 6f | 2c 20 77 65 20 77 6f 6e |t. if so|, we won|
|00005860| d5 74 20 63 68 65 63 6b | 20 74 68 65 20 63 6f 6e |.t check| the con|
|00005870| 74 72 6f 6c 73 20 2a 2f | 0d 09 09 47 65 74 54 45 |trols */|...GetTE|
|00005880| 52 65 63 74 28 77 69 6e | 64 6f 77 2c 20 26 74 65 |Rect(win|dow, &te|
|00005890| 52 65 63 74 29 3b 0d 09 | 09 69 66 20 28 20 50 74 |Rect);..|.if ( Pt|
|000058a0| 49 6e 52 65 63 74 28 6d | 6f 75 73 65 2c 20 26 74 |InRect(m|ouse, &t|
|000058b0| 65 52 65 63 74 29 20 29 | 20 7b 0d 09 09 09 2f 2a |eRect) )| {..../*|
|000058c0| 20 73 65 65 20 69 66 20 | 77 65 20 6e 65 65 64 20 | see if |we need |
|000058d0| 74 6f 20 65 78 74 65 6e | 64 20 74 68 65 20 73 65 |to exten|d the se|
|000058e0| 6c 65 63 74 69 6f 6e 20 | 2a 2f 0d 09 09 09 73 68 |lection |*/....sh|
|000058f0| 69 66 74 44 6f 77 6e 20 | 3d 20 28 65 76 65 6e 74 |iftDown |= (event|
|00005900| 2d 3e 6d 6f 64 69 66 69 | 65 72 73 20 26 20 73 68 |->modifi|ers & sh|
|00005910| 69 66 74 4b 65 79 29 20 | 21 3d 20 30 3b 09 2f 2a |iftKey) |!= 0;./*|
|00005920| 20 65 78 74 65 6e 64 20 | 69 66 20 53 68 69 66 74 | extend |if Shift|
|00005930| 20 69 73 20 64 6f 77 6e | 20 2a 2f 0d 09 09 09 54 | is down| */....T|
|00005940| 45 43 6c 69 63 6b 28 6d | 6f 75 73 65 2c 20 73 68 |EClick(m|ouse, sh|
|00005950| 69 66 74 44 6f 77 6e 2c | 20 64 6f 63 2d 3e 64 6f |iftDown,| doc->do|
|00005960| 63 54 45 29 3b 0d 09 09 | 7d 20 65 6c 73 65 20 7b |cTE);...|} else {|
|00005970| 0d 09 09 09 70 61 72 74 | 20 3d 20 46 69 6e 64 43 |....part| = FindC|
|00005980| 6f 6e 74 72 6f 6c 28 6d | 6f 75 73 65 2c 20 77 69 |ontrol(m|ouse, wi|
|00005990| 6e 64 6f 77 2c 20 26 63 | 6f 6e 74 72 6f 6c 29 3b |ndow, &c|ontrol);|
|000059a0| 0d 09 09 09 73 77 69 74 | 63 68 20 28 20 70 61 72 |....swit|ch ( par|
|000059b0| 74 20 29 20 7b 0d 09 09 | 09 09 63 61 73 65 20 30 |t ) {...|..case 0|
|000059c0| 3a 09 09 09 09 09 09 09 | 2f 2a 20 64 6f 20 6e 6f |:.......|/* do no|
|000059d0| 74 68 69 6e 67 20 66 6f | 72 20 76 69 65 77 52 65 |thing fo|r viewRe|
|000059e0| 63 74 20 63 61 73 65 20 | 2a 2f 0d 09 09 09 09 09 |ct case |*/......|
|000059f0| 62 72 65 61 6b 3b 0d 09 | 09 09 09 63 61 73 65 20 |break;..|...case |
|00005a00| 69 6e 54 68 75 6d 62 3a | 0d 09 09 09 09 09 76 61 |inThumb:|......va|
|00005a10| 6c 75 65 20 3d 20 47 65 | 74 43 74 6c 56 61 6c 75 |lue = Ge|tCtlValu|
|00005a20| 65 28 63 6f 6e 74 72 6f | 6c 29 3b 0d 09 09 09 09 |e(contro|l);.....|
|00005a30| 09 70 61 72 74 20 3d 20 | 54 72 61 63 6b 43 6f 6e |.part = |TrackCon|
|00005a40| 74 72 6f 6c 28 63 6f 6e | 74 72 6f 6c 2c 20 6d 6f |trol(con|trol, mo|
|00005a50| 75 73 65 2c 20 6e 69 6c | 29 3b 0d 09 09 09 09 09 |use, nil|);......|
|00005a60| 69 66 20 28 20 70 61 72 | 74 20 21 3d 20 30 20 29 |if ( par|t != 0 )|
|00005a70| 20 7b 0d 09 09 09 09 09 | 09 76 61 6c 75 65 20 2d | {......|.value -|
|00005a80| 3d 20 47 65 74 43 74 6c | 56 61 6c 75 65 28 63 6f |= GetCtl|Value(co|
|00005a90| 6e 74 72 6f 6c 29 3b 0d | 09 09 09 09 09 09 2f 2a |ntrol);.|....../*|
|00005aa0| 20 76 61 6c 75 65 20 6e | 6f 77 20 68 61 73 20 43 | value n|ow has C|
|00005ab0| 48 41 4e 47 45 20 69 6e | 20 76 61 6c 75 65 3b 20 |HANGE in| value; |
|00005ac0| 69 66 20 76 61 6c 75 65 | 20 63 68 61 6e 67 65 64 |if value| changed|
|00005ad0| 2c 20 73 63 72 6f 6c 6c | 20 2a 2f 0d 09 09 09 09 |, scroll| */.....|
|00005ae0| 09 09 69 66 20 28 20 76 | 61 6c 75 65 20 21 3d 20 |..if ( v|alue != |
|00005af0| 30 20 29 0d 09 09 09 09 | 09 09 09 69 66 20 28 20 |0 ).....|...if ( |
|00005b00| 63 6f 6e 74 72 6f 6c 20 | 3d 3d 20 64 6f 63 2d 3e |control |== doc->|
|00005b10| 64 6f 63 56 53 63 72 6f | 6c 6c 20 29 0d 09 09 09 |docVScro|ll )....|
|00005b20| 09 09 09 09 09 54 45 53 | 63 72 6f 6c 6c 28 30 2c |.....TES|croll(0,|
|00005b30| 20 76 61 6c 75 65 20 2a | 20 28 2a 64 6f 63 2d 3e | value *| (*doc->|
|00005b40| 64 6f 63 54 45 29 2d 3e | 6c 69 6e 65 48 65 69 67 |docTE)->|lineHeig|
|00005b50| 68 74 2c 20 64 6f 63 2d | 3e 64 6f 63 54 45 29 3b |ht, doc-|>docTE);|
|00005b60| 0d 09 09 09 09 09 09 09 | 65 6c 73 65 0d 09 09 09 |........|else....|
|00005b70| 09 09 09 09 09 54 45 53 | 63 72 6f 6c 6c 28 76 61 |.....TES|croll(va|
|00005b80| 6c 75 65 2c 20 30 2c 20 | 64 6f 63 2d 3e 64 6f 63 |lue, 0, |doc->doc|
|00005b90| 54 45 29 3b 0d 09 09 09 | 09 09 7d 0d 09 09 09 09 |TE);....|..}.....|
|00005ba0| 09 62 72 65 61 6b 3b 0d | 09 09 09 09 64 65 66 61 |.break;.|....defa|
|00005bb0| 75 6c 74 3a 09 09 09 09 | 09 09 2f 2a 20 74 68 65 |ult:....|../* the|
|00005bc0| 79 20 63 6c 69 63 6b 65 | 64 20 69 6e 20 61 6e 20 |y clicke|d in an |
|00005bd0| 61 72 72 6f 77 2c 20 73 | 6f 20 74 72 61 63 6b 20 |arrow, s|o track |
|00005be0| 26 20 73 63 72 6f 6c 6c | 20 2a 2f 0d 09 09 09 09 |& scroll| */.....|
|00005bf0| 09 69 66 20 28 20 63 6f | 6e 74 72 6f 6c 20 3d 3d |.if ( co|ntrol ==|
|00005c00| 20 64 6f 63 2d 3e 64 6f | 63 56 53 63 72 6f 6c 6c | doc->do|cVScroll|
|00005c10| 20 29 0d 09 09 09 09 09 | 09 76 61 6c 75 65 20 3d | )......|.value =|
|00005c20| 20 54 72 61 63 6b 43 6f | 6e 74 72 6f 6c 28 63 6f | TrackCo|ntrol(co|
|00005c30| 6e 74 72 6f 6c 2c 20 6d | 6f 75 73 65 2c 20 28 50 |ntrol, m|ouse, (P|
|00005c40| 72 6f 63 50 74 72 29 20 | 56 41 63 74 69 6f 6e 50 |rocPtr) |VActionP|
|00005c50| 72 6f 63 29 3b 0d 09 09 | 09 09 09 65 6c 73 65 0d |roc);...|...else.|
|00005c60| 09 09 09 09 09 09 76 61 | 6c 75 65 20 3d 20 54 72 |......va|lue = Tr|
|00005c70| 61 63 6b 43 6f 6e 74 72 | 6f 6c 28 63 6f 6e 74 72 |ackContr|ol(contr|
|00005c80| 6f 6c 2c 20 6d 6f 75 73 | 65 2c 20 28 50 72 6f 63 |ol, mous|e, (Proc|
|00005c90| 50 74 72 29 20 48 41 63 | 74 69 6f 6e 50 72 6f 63 |Ptr) HAc|tionProc|
|00005ca0| 29 3b 0d 09 09 09 09 09 | 62 72 65 61 6b 3b 0d 09 |);......|break;..|
|00005cb0| 09 09 7d 0d 09 09 7d 0d | 09 7d 0d 7d 20 2f 2a 44 |..}...}.|.}.} /*D|
|00005cc0| 6f 43 6f 6e 74 65 6e 74 | 43 6c 69 63 6b 2a 2f 0d |oContent|Click*/.|
|00005cd0| 0d 0d 2f 2a 20 54 68 69 | 73 20 69 73 20 63 61 6c |../* Thi|s is cal|
|00005ce0| 6c 65 64 20 66 6f 72 20 | 61 6e 79 20 6b 65 79 44 |led for |any keyD|
|00005cf0| 6f 77 6e 20 6f 72 20 61 | 75 74 6f 4b 65 79 20 65 |own or a|utoKey e|
|00005d00| 76 65 6e 74 73 2c 20 65 | 78 63 65 70 74 20 77 68 |vents, e|xcept wh|
|00005d10| 65 6e 20 74 68 65 0d 20 | 43 6f 6d 6d 61 6e 64 20 |en the. |Command |
|00005d20| 6b 65 79 20 69 73 20 68 | 65 6c 64 20 64 6f 77 6e |key is h|eld down|
|00005d30| 2e 20 49 74 20 6c 6f 6f | 6b 73 20 61 74 20 74 68 |. It loo|ks at th|
|00005d40| 65 20 66 72 6f 6e 74 6d | 6f 73 74 20 77 69 6e 64 |e frontm|ost wind|
|00005d50| 6f 77 20 74 6f 20 64 65 | 63 69 64 65 20 77 68 61 |ow to de|cide wha|
|00005d60| 74 0d 20 74 6f 20 64 6f | 20 77 69 74 68 20 74 68 |t. to do| with th|
|00005d70| 65 20 6b 65 79 20 74 79 | 70 65 64 2e 20 2a 2f 0d |e key ty|ped. */.|
|00005d80| 0d 23 64 65 66 69 6e 65 | 20 5f 5f 53 45 47 5f 5f |.#define| __SEG__|
|00005d90| 20 4d 61 69 6e 0d 76 6f | 69 64 20 44 6f 4b 65 79 | Main.vo|id DoKey|
|00005da0| 44 6f 77 6e 28 65 76 65 | 6e 74 29 0d 09 45 76 65 |Down(eve|nt)..Eve|
|00005db0| 6e 74 52 65 63 6f 72 64 | 09 2a 65 76 65 6e 74 3b |ntRecord|.*event;|
|00005dc0| 0d 7b 0d 09 57 69 6e 64 | 6f 77 50 74 72 09 77 69 |.{..Wind|owPtr.wi|
|00005dd0| 6e 64 6f 77 3b 0d 09 63 | 68 61 72 09 09 6b 65 79 |ndow;..c|har..key|
|00005de0| 3b 0d 09 54 45 48 61 6e | 64 6c 65 09 74 65 3b 0d |;..TEHan|dle.te;.|
|00005df0| 0d 09 77 69 6e 64 6f 77 | 20 3d 20 46 72 6f 6e 74 |..window| = Front|
|00005e00| 57 69 6e 64 6f 77 28 29 | 3b 0d 09 69 66 20 28 20 |Window()|;..if ( |
|00005e10| 49 73 41 70 70 57 69 6e | 64 6f 77 28 77 69 6e 64 |IsAppWin|dow(wind|
|00005e20| 6f 77 29 20 29 20 7b 0d | 09 09 74 65 20 3d 20 28 |ow) ) {.|..te = (|
|00005e30| 28 44 6f 63 75 6d 65 6e | 74 50 65 65 6b 29 20 77 |(Documen|tPeek) w|
|00005e40| 69 6e 64 6f 77 29 2d 3e | 64 6f 63 54 45 3b 0d 09 |indow)->|docTE;..|
|00005e50| 09 6b 65 79 20 3d 20 65 | 76 65 6e 74 2d 3e 6d 65 |.key = e|vent->me|
|00005e60| 73 73 61 67 65 20 26 20 | 63 68 61 72 43 6f 64 65 |ssage & |charCode|
|00005e70| 4d 61 73 6b 3b 0d 09 09 | 2f 2a 20 77 65 20 68 61 |Mask;...|/* we ha|
|00005e80| 76 65 20 61 20 63 68 61 | 72 2e 20 66 6f 72 20 6f |ve a cha|r. for o|
|00005e90| 75 72 20 77 69 6e 64 6f | 77 3b 20 73 65 65 20 69 |ur windo|w; see i|
|00005ea0| 66 20 77 65 20 61 72 65 | 20 73 74 69 6c 6c 20 62 |f we are| still b|
|00005eb0| 65 6c 6f 77 20 54 65 78 | 74 45 64 69 74 d5 73 0d |elow Tex|tEdit.s.|
|00005ec0| 09 09 09 6c 69 6d 69 74 | 20 66 6f 72 20 74 68 65 |...limit| for the|
|00005ed0| 20 6e 75 6d 62 65 72 20 | 6f 66 20 63 68 61 72 61 | number |of chara|
|00005ee0| 63 74 65 72 73 20 28 62 | 75 74 20 64 65 6c 65 74 |cters (b|ut delet|
|00005ef0| 65 73 20 61 72 65 20 61 | 6c 77 61 79 73 20 72 61 |es are a|lways ra|
|00005f00| 64 29 20 2a 2f 0d 09 09 | 69 66 20 28 20 6b 65 79 |d) */...|if ( key|
|00005f10| 20 3d 3d 20 6b 44 65 6c | 43 68 61 72 20 7c 7c 0d | == kDel|Char ||.|
|00005f20| 09 09 09 09 28 2a 74 65 | 29 2d 3e 74 65 4c 65 6e |....(*te|)->teLen|
|00005f30| 67 74 68 20 2d 20 28 28 | 2a 74 65 29 2d 3e 73 65 |gth - ((|*te)->se|
|00005f40| 6c 45 6e 64 20 2d 20 28 | 2a 74 65 29 2d 3e 73 65 |lEnd - (|*te)->se|
|00005f50| 6c 53 74 61 72 74 29 20 | 2b 20 31 20 3c 0d 09 09 |lStart) |+ 1 <...|
|00005f60| 09 09 6b 4d 61 78 54 45 | 4c 65 6e 67 74 68 20 29 |..kMaxTE|Length )|
|00005f70| 20 7b 0d 09 09 09 54 45 | 4b 65 79 28 6b 65 79 2c | {....TE|Key(key,|
|00005f80| 20 74 65 29 3b 0d 09 09 | 09 41 64 6a 75 73 74 53 | te);...|.AdjustS|
|00005f90| 63 72 6f 6c 6c 62 61 72 | 73 28 77 69 6e 64 6f 77 |crollbar|s(window|
|00005fa0| 2c 20 66 61 6c 73 65 29 | 3b 0d 09 09 09 41 64 6a |, false)|;....Adj|
|00005fb0| 75 73 74 54 45 28 77 69 | 6e 64 6f 77 29 3b 0d 09 |ustTE(wi|ndow);..|
|00005fc0| 09 7d 20 65 6c 73 65 0d | 09 09 09 41 6c 65 72 74 |.} else.|...Alert|
|00005fd0| 55 73 65 72 28 65 45 78 | 63 65 65 64 43 68 61 72 |User(eEx|ceedChar|
|00005fe0| 29 3b 0d 09 7d 0d 7d 20 | 2f 2a 44 6f 4b 65 79 44 |);..}.} |/*DoKeyD|
|00005ff0| 6f 77 6e 2a 2f 0d 0d 0d | 2f 2a 09 43 61 6c 63 75 |own*/...|/*.Calcu|
|00006000| 6c 61 74 65 20 61 20 73 | 6c 65 65 70 20 76 61 6c |late a s|leep val|
|00006010| 75 65 20 66 6f 72 20 57 | 61 69 74 4e 65 78 74 45 |ue for W|aitNextE|
|00006020| 76 65 6e 74 2e 20 54 68 | 69 73 20 74 61 6b 65 73 |vent. Th|is takes|
|00006030| 20 69 6e 74 6f 20 61 63 | 63 6f 75 6e 74 20 74 68 | into ac|count th|
|00006040| 65 20 74 68 69 6e 67 73 | 0d 09 74 68 61 74 20 44 |e things|..that D|
|00006050| 6f 49 64 6c 65 20 64 6f | 65 73 20 77 69 74 68 20 |oIdle do|es with |
|00006060| 69 64 6c 65 20 74 69 6d | 65 2e 20 2a 2f 0d 0d 23 |idle tim|e. */..#|
|00006070| 64 65 66 69 6e 65 20 5f | 5f 53 45 47 5f 5f 20 4d |define _|_SEG__ M|
|00006080| 61 69 6e 0d 75 6e 73 69 | 67 6e 65 64 20 6c 6f 6e |ain.unsi|gned lon|
|00006090| 67 20 47 65 74 53 6c 65 | 65 70 28 29 0d 7b 0d 09 |g GetSle|ep().{..|
|000060a0| 6c 6f 6e 67 09 09 73 6c | 65 65 70 3b 0d 09 57 69 |long..sl|eep;..Wi|
|000060b0| 6e 64 6f 77 50 74 72 09 | 77 69 6e 64 6f 77 3b 0d |ndowPtr.|window;.|
|000060c0| 09 54 45 48 61 6e 64 6c | 65 09 74 65 3b 0d 0d 09 |.TEHandl|e.te;...|
|000060d0| 73 6c 65 65 70 20 3d 20 | 4d 41 58 4c 4f 4e 47 3b |sleep = |MAXLONG;|
|000060e0| 09 09 09 09 09 09 2f 2a | 20 64 65 66 61 75 6c 74 |....../*| default|
|000060f0| 20 76 61 6c 75 65 20 66 | 6f 72 20 73 6c 65 65 70 | value f|or sleep|
|00006100| 20 2a 2f 0d 09 69 66 20 | 28 20 21 67 49 6e 42 61 | */..if |( !gInBa|
|00006110| 63 6b 67 72 6f 75 6e 64 | 20 29 20 7b 0d 09 09 77 |ckground| ) {...w|
|00006120| 69 6e 64 6f 77 20 3d 20 | 46 72 6f 6e 74 57 69 6e |indow = |FrontWin|
|00006130| 64 6f 77 28 29 3b 09 09 | 09 2f 2a 20 61 6e 64 20 |dow();..|./* and |
|00006140| 74 68 65 20 66 72 6f 6e | 74 20 77 69 6e 64 6f 77 |the fron|t window|
|00006150| 20 69 73 20 6f 75 72 73 | 2e 2e 2e 20 2a 2f 0d 09 | is ours|... */..|
|00006160| 09 69 66 20 28 20 49 73 | 41 70 70 57 69 6e 64 6f |.if ( Is|AppWindo|
|00006170| 77 28 77 69 6e 64 6f 77 | 29 20 29 20 7b 0d 09 09 |w(window|) ) {...|
|00006180| 09 74 65 20 3d 20 28 28 | 44 6f 63 75 6d 65 6e 74 |.te = ((|Document|
|00006190| 50 65 65 6b 29 20 28 77 | 69 6e 64 6f 77 29 29 2d |Peek) (w|indow))-|
|000061a0| 3e 64 6f 63 54 45 3b 09 | 2f 2a 20 61 6e 64 20 74 |>docTE;.|/* and t|
|000061b0| 68 65 20 73 65 6c 65 63 | 74 69 6f 6e 20 69 73 20 |he selec|tion is |
|000061c0| 61 6e 20 69 6e 73 65 72 | 74 69 6f 6e 20 70 6f 69 |an inser|tion poi|
|000061d0| 6e 74 2e 2e 2e 20 2a 2f | 0d 09 09 09 69 66 20 28 |nt... */|....if (|
|000061e0| 20 28 2a 74 65 29 2d 3e | 73 65 6c 53 74 61 72 74 | (*te)->|selStart|
|000061f0| 20 3d 3d 20 28 2a 74 65 | 29 2d 3e 73 65 6c 45 6e | == (*te|)->selEn|
|00006200| 64 20 29 0d 09 09 09 09 | 73 6c 65 65 70 20 3d 20 |d ).....|sleep = |
|00006210| 47 65 74 43 61 72 65 74 | 54 69 6d 65 28 29 3b 09 |GetCaret|Time();.|
|00006220| 09 2f 2a 20 62 6c 69 6e | 6b 20 74 69 6d 65 20 66 |./* blin|k time f|
|00006230| 6f 72 20 74 68 65 20 69 | 6e 73 65 72 74 69 6f 6e |or the i|nsertion|
|00006240| 20 70 6f 69 6e 74 20 2a | 2f 0d 09 09 7d 0d 09 7d | point *|/...}..}|
|00006250| 0d 09 72 65 74 75 72 6e | 20 73 6c 65 65 70 3b 0d |..return| sleep;.|
|00006260| 7d 20 2f 2a 47 65 74 53 | 6c 65 65 70 2a 2f 0d 0d |} /*GetS|leep*/..|
|00006270| 0d 2f 2a 09 43 6f 6d 6d | 6f 6e 20 61 6c 67 6f 72 |./*.Comm|on algor|
|00006280| 69 74 68 6d 20 66 6f 72 | 20 70 69 6e 6e 69 6e 67 |ithm for| pinning|
|00006290| 20 74 68 65 20 76 61 6c | 75 65 20 6f 66 20 61 20 | the val|ue of a |
|000062a0| 63 6f 6e 74 72 6f 6c 2e | 20 49 74 20 72 65 74 75 |control.| It retu|
|000062b0| 72 6e 73 20 74 68 65 20 | 61 63 74 75 61 6c 20 61 |rns the |actual a|
|000062c0| 6d 6f 75 6e 74 0d 09 74 | 68 65 20 76 61 6c 75 65 |mount..t|he value|
|000062d0| 20 6f 66 20 74 68 65 20 | 63 6f 6e 74 72 6f 6c 20 | of the |control |
|000062e0| 63 68 61 6e 67 65 64 2e | 20 4e 6f 74 65 20 74 68 |changed.| Note th|
|000062f0| 65 20 70 69 6e 6e 69 6e | 67 20 69 73 20 64 6f 6e |e pinnin|g is don|
|00006300| 65 20 66 6f 72 20 74 68 | 65 20 73 61 6b 65 20 6f |e for th|e sake o|
|00006310| 66 20 72 65 74 75 72 6e | 69 6e 67 0d 09 74 68 65 |f return|ing..the|
|00006320| 20 61 6d 6f 75 6e 74 20 | 74 68 65 20 63 6f 6e 74 | amount |the cont|
|00006330| 72 6f 6c 20 76 61 6c 75 | 65 20 63 68 61 6e 67 65 |rol valu|e change|
|00006340| 64 2e 20 2a 2f 0d 0d 23 | 64 65 66 69 6e 65 20 5f |d. */..#|define _|
|00006350| 5f 53 45 47 5f 5f 20 4d | 61 69 6e 0d 76 6f 69 64 |_SEG__ M|ain.void|
|00006360| 20 43 6f 6d 6d 6f 6e 41 | 63 74 69 6f 6e 28 63 6f | CommonA|ction(co|
|00006370| 6e 74 72 6f 6c 2c 61 6d | 6f 75 6e 74 29 0d 09 43 |ntrol,am|ount)..C|
|00006380| 6f 6e 74 72 6f 6c 48 61 | 6e 64 6c 65 20 63 6f 6e |ontrolHa|ndle con|
|00006390| 74 72 6f 6c 3b 0d 09 73 | 68 6f 72 74 09 09 2a 61 |trol;..s|hort..*a|
|000063a0| 6d 6f 75 6e 74 3b 0d 7b | 0d 09 73 68 6f 72 74 09 |mount;.{|..short.|
|000063b0| 09 76 61 6c 75 65 2c 20 | 6d 61 78 3b 0d 09 0d 09 |.value, |max;....|
|000063c0| 76 61 6c 75 65 20 3d 20 | 47 65 74 43 74 6c 56 61 |value = |GetCtlVa|
|000063d0| 6c 75 65 28 63 6f 6e 74 | 72 6f 6c 29 3b 09 2f 2a |lue(cont|rol);./*|
|000063e0| 20 67 65 74 20 63 75 72 | 72 65 6e 74 20 76 61 6c | get cur|rent val|
|000063f0| 75 65 20 2a 2f 0d 09 6d | 61 78 20 3d 20 47 65 74 |ue */..m|ax = Get|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.